PHP - Debug_backtrace Notice-what’s Causing It In My Code?
I have this function which works except it throws a Notice regarding the 3rd line of the function. The Notice reads "Only variables should be passed by reference..." What am I doing wrong in that 3rd line—$caller = next(debug_backtrace()) [‘function’]; ? //EMAIL_ADMIN //Sends email to site admin if email testing services fail. //Only occurs if both primary and secondary services have failed. //Calls no other function. //Called by test_email function. //*************************************************************** function email_admin($email){ global $full_site_url;//used in links. global $site_title;//used in confirmation messages. $caller = next(debug_backtrace())['function']; //assigns calling function name to $caller. if ($caller == 'alt_test_email'){ //used in email message to provide links for checking services. $primary_service = 'http://www.quickemailverification.com';//used in email message. $secondary_service = 'http://www.neverbounce.com';//used in email message. $to = get_bloginfo('admin_email'); $subject = 'EMAIL TESTING SERVICES HAVE FAILED!'; $message = 'Both email testing services have failed. Go to ' . $primary_service . ' and ' . $secondary_service . '.'; dw_send_email($to, $subject, $message);//call email sending function. } if ($caller == 'unsubscribe'){ $to = get_bloginfo('admin_email'); $subject = $site_title . " unsubscribe"; $message = $email . " has unsubscribed."; dw_send_email($to, $subject, $message);//call email sending function. } if ($caller == 'subscribe_form_display'){ $to = get_bloginfo('admin_email'); $subject = "New " . $site_title . " subscriber"; $message = $email . " has subscribed to " . $site_title . "."; dw_send_email($to, $subject, $message);//call email sending function. } }
Similar TutorialsOk, to be fair, I’m brand new to PHP and just trying to piece this together for a friends website. The idea of this code is if a value of 1 is given in the data entry it would return house and so on. But right now, even if it’s a 3 it’s just returning house instead of Mobile Home. I’ve tried everything I know and googled for ever, but if you don’t know the right language to google, it’s impossible. I have a feeling this is a simple fix and I just don’t know it.
function property_structure_type ($data){ $data = array("1", "2", "3", "4", "5", "6", "7");
So I have an webapp which has a built in proxy checker. However because I didn't write the code I am kind of confused on whats going on. I have a small amount of knowledge on php been looking all over the net to find a solution. So this file called (proxy_check.php) keeps causing my index.php to show the 404 designed page. The file is required in the index.php file. I believe its something to do with the $reponse variable. Please help <?php # Visitor proxy check snippet $v_ip = $_SERVER['REMOTE_ADDR']; $arContext['http']['timeout'] = 10; $context = stream_context_create($arContext); $response = file_get_contents('http://www.shroomery.org/ythan/proxycheck.php?ip='.$v_ip, 0, $context); if ('Y' === $response) { echo "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'> <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'> <head> <title> The page you were looking for doesn't exist (THIS BUG)</title> <style type='text/css'> body { background-color: #efefef; color: #333; font-family: Georgia,Palatino,'Book Antiqua',serif;padding:0;margin:0;text-align:center; } p {font-style:italic;} div.dialog { width: 490px; margin: 4em auto 0 auto; } img { border:none; } </style> </head> <body> <div class='dialog'> <a><img src='assets/img/404.png'></a> <p>It looks like that page you were looking has been mislaid, sorry.</p> </div> </body> </html>"; die(); }
I am using the debug_backtrace() php function to prevent direct access to admin files.
i simply place the code below at the top of a page eg config.php and direct access via the browser is prevented.
Is it a safe practice or is there a better way of doing it?
<?php debug_backtrace() || die ("Direct access to this resource is forbidden"); ?>Thanks Hey, I'm writing an application that tracks attendance. There are multiple events ('events' table), in which members that are present will be found. (When an event file is uploaded, it has all members that attended the event, and adds the event entry in 'events', as well as adding each member to the 'attendance' table, with event_id(eid) and the 'did_attend' value as '1'. When the event is edited, it needs to find the other members that AREN'T in the events table, and add them to the 'attendance' table. When I use this code, it apparently keeps adding the same members. Will a LIMIT 1 stop this? I has about 65,000+ entries added before I stopped the execution of the script. Thanks! Code: [Select] $sql2 = mysql_query("SELECT * FROM members WHERE status=1 ORDER BY mid ASC"); while($row = mysql_fetch_assoc($sql2)){ $sql3 = mysql_query("SELECT * FROM attendance WHERE event='$eid' ORDER BY member ASC"); while($row2 = mysql_fetch_assoc($sql3)){ if($row2[mid] == $row[mid]){ // if the member is in the attendance db, skip }else{ //if member is not in attendance, write zero--- causing multiple entries (50,000+) $qry = mysql_query("INSERT INTO attendance (member,event,did_attend) VALUES ('$row[mid]','$eid','0')"); if(!$qry){ die("SQL: ".mysql_error()); }else{ $msg = "<br />Member ".$row[mid]." marked as absent."; } } } } I have several pages on my site using the exact same code at the very top, which works fine except for one page: <?php include_once("../members/dbinfo.php"); The top of dbinfo looks like this: <?php session_start(); And then the connection strings for the database However it is giving me this error on this one page: Quote Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Inetpub\WebSites\premierathome_com\products\FrenchTalkingDictionary.php:1) in C:\Inetpub\WebSites\premierathome_com\members\dbinfo.php on line 1 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Inetpub\WebSites\premierathome_com\products\FrenchTalkingDictionary.php:1) in C:\Inetpub\WebSites\premierathome_com\members\dbinfo.php on line 1 Now the session does actually start and doesn't prevent anything from working, I just get those messages. I'm at a loss as to why a different page with the exact same code, save for searching the database for a different product version would have this problem. I have had this code in place as well which works fine on other pages but doesn't help my problem at all: if(!isset($_SESSION['OK'])){ session_start(); } OK being a variable I set up during log in. I'm at a loss, is anyone able to help me out with this? Okay, I have no idea how this works out but this is really getting on my nerves. Here is my logic for the following code. I manually register a user, It goes into the database and dispatches an email notification explaining that a user must activate their account and change their user name (OPTIONAL) and password. In the email, There is an automatically generated password with the username, And a link to activate the account. This leads to stage 1 of the activation process, In this stage the user is accepted, Registered as a verified user and then is sent to another page to change the details like login and password. As far as I know this page works except through trial and error I found that this little snippet of code is causing browsers to show an error 500 page, If I remove this the page works: <?php if($messages){ displayErrors($messages); } else { echo("<p align=\"center\" class=\"standard\">Your account has been activated.</p><p align=\"center\" class=\"standard\">You now need to change your password. If you like you can also change your username, Remember that you only have 3 days to do so and this change will be permanent.</p>"); } ?> and this is the displayErrors function: <?php function displayErrors($messages) { print("<p align=\"center\" class=\"standard\">"."<b>There were problems with the previous action:</b>\n<ul>\n"); foreach($messages as $msg){ print("<li>$msg</li>\n"); } print("</ul>\n"."</p>"); } ?> The displayErrors function is in a file called functions.php, Which is included in config.php, Which is included in every page including this one. The entire "Change password and login page thingie" is he <?php include("config.php"); global $link, $messages; require_once('recaptchalib.php'); if($_GET['error']){ $id=$_GET['id']; $messages[]="There is more than one or no accounts with the verification code you are using. <a href=\"mailto:rentals@nivso.co.uk?subject=Two or no accounts with activation ID of $id\">Click here to email us about this and have the problem sorted.</a>"; doIndex(); exit; } if(isset($_POST['submit'])){ if(!isset($_POST['activationid'])){ die("Doesn't exist -.- might as well quit this is *STUFF* -.-"); } $privatekey = "YOUR NOT HAVING THIS"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { $messages[]="The code you entered is incorrect. Please go back and try again!"; doIndex(); exit; // exit or the below lines will be processed. } else { //This is where the fun starts! $login=$_POST['login']; $passw=$_POST['password']; $passc=$_POST['passwordc']; $id2=$_POST['activationid']; $changinglogin=false; $get1=excDB("SELECT * FROM `users` WHERE `activeID`='$id2'"); if($get1[0]){ $get1=$get1[1]; } else { die($get1[2]); } $pro1=mysql_fetch_array($get1); if($pro1['login']!=$login){ $changinglogin=true; field_validator("Login", $login, "alphanumeric", 4, 15); } field_validator("Password", $passw, "string", 6, 20); if($passw!=$passc){ $messages[]="The passwords do not match, Please make sure that the passwords are the same!"; } if($messages){ doIndex(); exit; } $passcl=mysql_escape_string($passw); $passen=md5($passcl); if($changinglogin){ $wri1=excDB("UPDATE `users` SET `login`='$login', `password`='$passen', `passchange`='1', `loginchange`='1' WHERE `activeID`='$id2';"); if($wri1[0]){ $wri1=$wri1[1]; } else { die($wri1[2]); } header("Location: login.php?created"); } else { $wri1=excDB("UPDATE `users` SET `password`='$passen', `passchange`='1', `loginchange`='0' WHERE `activeID`='$id2';"); if($wri1[0]){ $wri1=$wri1[1]; } else { die($wri1[2]); } header("Location: login.php?created2"); } } } else { doIndex(); } function doIndex(){ ?> <!DOCTYPE html> <head> <title>Family Rental System! - Rent your DVDs here - Design by Alex, Coding by Gergy008</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link type="text/css" href="css/main.css" rel="stylesheet"> <style type="text/css"> <!-- body { background-color: #333333; } --> </style></head> <body style="text-align:center;"> <div class="first"> <div class="backgrounder1"></div> <div class="headerbar1"></div> <div class="headerbar2"></div> </div> <div align="center"> <table border="0" cellpadding="0" cellspacing="0" width="900"> <tr> <td><img src="images/spacer.gif" width="52" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="123" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="352" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="33" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="55" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="110" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="110" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="50" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="15" height="1" border="0" alt="" /></td> <td><img src="images/spacer.gif" width="1" height="1" border="0" alt="" /></td> </tr> <tr> <td colspan="9" background="images/template.slice.1.png"> </td> <td><img src="images/spacer.gif" width="1" height="20" border="0" alt="" /></td> </tr> <tr> <td colspan="5" background="images/template.slice.2.png"> </td> <td colspan="2" rowspan="2" background="images/template.slice.3.png"><span class="login"><?php echo(loginHandler()); ?></span></td> <td colspan="2" rowspan="3" background="images/template.slice.4.png"> </td> <td><img src="images/spacer.gif" width="1" height="30" border="0" alt="" /></td> </tr> <tr> <td rowspan="8" background="images/template.slice.5.png"> </td> <td colspan="2" background="images/template.slice.6.png"><form> <div align="center"> <input name="textfield" type="text" id="textfield" size="40" style="height:16px;"> <input type="submit" name="button" id="button" value="Search" style="height:20px;"> </div> </form></td> <td colspan="2" rowspan="2" background="images/template.slice.7.png"> </td> <td><img src="images/spacer.gif" width="1" height="30" border="0" alt="" /></td> </tr> <tr> <td colspan="2" rowspan="3" background="images/template.slice.8.png"><p> </p> <p> </p></td> <td colspan="2" background="images/template.slice.9.png"> </td> <td><img src="images/spacer.gif" width="1" height="70" border="0" alt="" /></td> </tr> <tr> <td rowspan="2" background="images/template.slice.10.png"> </td> <td colspan="4" background="images/template.slice.11.png"> </td> <td rowspan="6" background="images/template.slice.12.png"> </td> <td><img src="images/spacer.gif" width="1" height="30" border="0" alt="" /></td> </tr> <tr> <td colspan="4" background="images/template.slice.13.png"></td> <td><img src="images/spacer.gif" width="1" height="8" border="0" alt="" /></td> </tr> <tr> <td rowspan="4" background="images/template.slice.14.png"> </td> <td colspan="4" background="images/template.slice.15.png"> </td> <td colspan="2" rowspan="4" background="images/template.slice.16.png"> </td> <td><img src="images/spacer.gif" width="1" height="35" border="0" alt="" /></td> </tr> <tr> <td colspan="4" background="images/template.slice.17.png"> </td> <td><img src="images/spacer.gif" width="1" height="37" border="0" alt="" /></td> </tr> <tr> <td colspan="4" align="center" valign="top" background="images/template.slice.18.png" style="vertical-align:top;"><p class="standard"> </p> <table width="80%" border="0"> <tr> <td colspan="2"> <?php if($messages){ //displayErrors($messages); } else { //echo("<p align=\"center\" class=\"standard\">Your account has been activated.</p><p align=\"center\" class=\"standard\">You now need to change your password. If you like you can also change your username, Remember that you only have 3 days to do so and this change will be permanent.</p>"); ?></td> </tr> <form name="ChangeDetails" method="post" action="<?=$_SERVER['PHP_SELF']?>"> <input type="hidden" name="activationid" value="<?php if($_GET['id']){ $id=$_GET['id']; echo($id); } elseif($_POST['activationid']){ $id=$_POST['activationid']; echo($id); } else { die("No ID") } ?>" /> <tr> <td width="50%"><div align="right" class="standard">New Username: </div></td> <td width="50%"><input name="login" type="text" id="login" size="35" maxlength="30" /></td> </tr> <tr> <td><div align="right" class="standard">New Password:</div></td> <td><input name="password" type="password" id="password" size="35" maxlength="30" /></td> </tr> <tr> <td><div align="right" class="standard">Re-enter password:</div></td> <td><input name="passwordc" type="password" id="passwordc" size="35" maxlength="30" /></td> </tr> <tr> <td><div align="right" class="standard">Please enter the code: </div></td> <td> <?php require_once('recaptchalib.php'); $publickey = "6Le4fsESAAAAAKMOHb8aaiyDfGRJyr0y0EU7dXm-"; // you got this from the signup page echo recaptcha_get_html($publickey); ?> </td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" id="submit" value="Change your details" /></td> </tr> </form> </table> </td> <td><img src="images/spacer.gif" width="1" height="450" border="0" alt="" /></td> </tr> <tr> <td colspan="4" background="images/template.slice.19.png"> </td> <td><img src="images/spacer.gif" width="1" height="50" border="0" alt="" /></td> </tr> <tr> <td colspan="9" background="images/template.slice.20.png"> </td> <td><img src="images/spacer.gif" width="1" height="40" border="0" alt="" /></td> </tr> </table> </div> </body> </html> <?php } ?> Thanks to all you kind people that take your time to read and help me with this problem. I'm sorry if it is a really simple problem I missed out that makes me look like a right idiot and wasted your time, but that's me I'm always missing stuff out like that, I do proof read though just sometimes not good enough. Thanks in advance! Hi, For about a month, I have been trying to figure out why my code will not return anything after posting a wwwForm (I have also tried the newer equivalent of this function but I had no luck with that either.) The nameField and passwordField are taken from text boxes within the game and the code used in my login script is copied and pasted from a Register script but I have changed the file location to the login.php file. The register script works fine and I can add new users to my database but the login script only outputs "Form Sent." and not the "present" that should return when the form is returned and it never gets any further than that point meaning that it lets the user through with no consequence if they use an invalid name because the script never returns an answer. What should I do to fix this? Thanks, Unity Code: using System.Collections; using UnityEngine; using UnityEngine.UI; using UnityEngine.Networking; public class Login : MonoBehaviour { public InputField nameField; public InputField passwordField; public Button acceptSubmissionButton; public void CallLogInCoroutine() { StartCoroutine(LogIn()); } IEnumerator LogIn() { WWWForm form = new WWWForm(); form.AddField("username", nameField.text); form.AddField("password", passwordField.text); WWW www = new WWW("http://localhost/sqlconnect/login.php", form); Debug.Log("Form Sent."); yield return www; Debug.Log("Present"); if (www.text[0] == '0') { Debug.Log("Present2"); DatabaseManager.username = nameField.text; DatabaseManager.score = int.Parse(www.text.Split('\t')[1]); Debug.Log("Log In Success."); } else { Debug.Log("User Login Failed. Error #" + www.text); } } public void Validation() { acceptSubmissionButton.interactable = nameField.text.Length >= 7 && passwordField.text.Length >= 8; } } login.php: <?php echo "Test String2"; $con = mysqli_connect('localhost', 'root', 'root', 'computer science coursework'); // check for successful connection. if (mysqli_connect_errno()) { echo "1: Connection failed"; // Error code #1 - connection failed. exit(); } $username = mysqli_escape_string($con, $_POST["username"]); $usernameClean = filter_var($username, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH); $password = $_POST["password"]; if($username != $usernameClean) { echo "7: Illegal Username, Potential SQL Injection Query. Access Denied."; exit(); } // check for if the name already exists. $namecheckquery = "SELECT username, salt, hash, score FROM players WHERE username='" . $usernameClean . "';"; $namecheck = mysqli_query($con, $namecheckquery) or die("2: Name check query failed"); // Error code # 2 - name check query failed. if (mysqli_num_rows($namecheck) != 1) { echo "5: No User With Your Log In Details Were Found Or More Than One User With Your Log In Details Were Found"; // Error code #5 - other than 1 user found with login details exit(); } // get login info from query $existinginfo = mysqli_fetch_assoc($namecheck); $salt = $existinginfo["salt"]; $hash = $existinginfo["hash"]; $loginhash = crypt($password, $salt); if ($hash != $loginhash) { echo "6: Incorrect Password"; // error code #6 - password does not hash to match table exit; } echo "Test String2"; echo"0\t" . $existinginfo["score"]; ?>
hi, I need help really badly for my PHP-Postcard Script. Basically it sends the card out but the URL does not work, I get the following error message: The URL is not valid and cannot be loaded It also states that Notice: Undefined index: www.voluntary.awardspace.co.uk in /home/www/voluntary.awardspace.co.uk/Postcard.php on line 25 Notice: Undefined index: Postcard.php in /home/www/voluntary.awardspace.co.uk/Postcard.php on line 25 See Code below: <?php session_start(); //check error log ini_set('display_errors', 1); ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . '/error_log.txt'); error_reporting(E_ALL); // CHANGE PARAMETERS HERE BEGIN $senderName = " Holidays From Home "; // Eg.: John's Postcards $senderEmail = "chris01@voluntary.awardspace.co.uk"; // Eg.: john@postcard.com // Change only if you have problems with urls $postcardURL = "http://".$_SERVER["www.voluntary.awardspace.co.uk"].$_SERVER["Postcard.php"]; // CHANGE PARAMETERS HERE END $result = 0; $msg = ""; $msg1 = ""; $pic = ""; function displayPhotos() { global $pic; $columns = 5; $act = 0; $act1 = 0; // Open the actual directory if($handle = opendir("thumbs")) { // Read all file from the actual directory while($file = readdir($handle)) { if(!is_dir($file)) { if(isset($pic[1])) { if($pic[1] == $act1){$sel = "checked";} else{$sel = "unchecked";} } if($act == 0){echo "<tr>";} echo "<td align='center'><img src='thumbs/$file' alt='postcard'/><br/><input type='radio' name='selimg' value='$file,$act1' $sel/></td>"; $act++; $act1++; if($act == $columns){$act = 0;echo "</tr>";} } } echo "</tr>"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Micro Postcard</title> <link href= "style/style.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <div class="style1" id="caption"> <div align="left" class="style1"></div> </div> <?php //makes sure form is correctly filled in if(!empty($_POST["submit"])) { if(empty($_POST["selimg"])){$msg = "Please select an image from above!";$result = 3;} else{$pic = explode(",",$_POST["selimg"]);} if(empty($_POST["email"]) && empty($result)){$msg1 = "You must enter an email address!";$result = 3;} $secCode = empty($_POST["secCode"]) ? "" : strtolower($_POST["secCode"]); if($secCode == $_SESSION["securityCode"] && $result != 3) { $filename = date("YmdGis"); $f = fopen("messages/".$filename.".txt","w+"); fwrite($f,$pic[0]."\n"); fwrite($f,$_POST['email']."\n"); fwrite($f,stripslashes($_POST["message"])."\n"); fclose($f); // Compose the mail $from = "From: $senderName <$senderEmail>\r\n"; $replay = "Reply-To: $senderEmail\r\n"; $params = "MIME-Version: 1.0\r\n"; $params .= "Content-type: text/plain; charset=iso-8859-1\r\n"; $mailtext = "You have just received a Virtual Postcard!\r\n\r\n You can pick up your postcard at the following web address:\r\n $postcardURL?show=$filename\r\n\r\n We hope you enjoy your postcard, and if you do, please take a moment to send a few yourself!\r\n\r\n Regards,\r\n Holidays From Home\r\n $postcardURL"; // Send email @mail($_POST["email"],"You've received a postcard",$mailtext,$from.$replay.$params); echo "<center> Your postcard was sent successfully!<br /><br /> <img src='images/$pic[0]' alt='postcard' /><br /><br /><br />".stripslashes($_POST["message"]). "</center>"; $result = 1; } else{if($result != 3){$result = 2;}} } if(!empty($_GET["show"])) { $file = $_GET["show"]; $content = file("messages/$file.txt"); $pic = $content[0]; unset($content[0]); unset($content[1]); foreach($content as $value){$main .= $value;} echo "<center> Your postcard!<br /><br /> <img src='images/$pic' alt='postcard' /><br /><br /><br />$main </center>"; } if((empty($result) || $result == 2 || $result == 3) && empty($_GET["show"])) { echo "<form action='#' method='post'> <table align='center'>"; displayPhotos(); echo "</table> <div style='color:#f00;font-size:16px;'>$msg</div> <h2>Fill in the Form and then click on Send Card!!</h2> <table width='100%'> <tr><td>Send to (email address):</td><td><div style='color:#f00;font-size:16px;'>$msg1</div><input type='text' name='email' size='30' value='".$_POST["email"]."' /></td></tr> <tr><td>Message:</td><td><textarea name='message' rows='10' cols='40'>".stripslashes($_POST["message"])."</textarea></td></tr> <tr><td colspan='2'>".($result == 2 ? "<p style='color:#f00;font-size:16px;'>Sorry the security code is invalid! Please try it again!</span></p>" : " ")."</tr> <tr> <td>Security code: <input class='text' name='secCode' type='text' size='10' /> </td><td><img src='securityCode.php' alt='security code' border='1' /></td> </tr> <tr><td colspan='2'> </tr> <tr><td colspan='2' align='left'><input type='submit' value='Send card!' name='submit'/></td></tr> </table> </form>"; } ?> Absolutely any help would be much appreciated. I want ot know is there a way round this problem? Here is the http://voluntary.awardspace.co.uk/Postcard.php I am absolutely desperate to solve this burning issue Hey I updated my WAMP server the other day and I am getting al of these Errors now. Notice: Undefined variable: ac in C:\wamp\www\xxxxx\newupdates.php on line 15 And there is about 25 of them on one page, and they are all over the place. Undoubtly it is my poor coding, but how come it never showed up before, and the site itself still works. Any help would be great, I basically wont to get rid of these Well hello studies?, Well I'm new to PHP was putting into practice what you learned during the school days and I'm having errors like these I'm getting the following notice: Notice: Undefined variable: TotaalBerichten in C:\Users\Sander\Documents\**********************\index.php on line 60 Is it because it is in the IF? The code: //Aantal berichten totaal if (!$ResultTotaalBerichten = @mysql_query("SELECT COUNT(1) FROM " . $db_prefix . "berichten")) {$foutmelding .= $Taal['errorConfiguratieFromDB'];} else {$TotaalBerichten = mysql_result($ResultTotaalBerichten, 0); $TotaalPaginas = ceil($TotaalBerichten / $aantalBerichtenPerPagina);} @mysql_free_result($ResultTotaalBerichten); //Var eersteBericht is het eerste bericht if (isset($_GET['eersteBericht'])) {if (!is_numeric($_GET['eersteBericht'])) {$eersteBericht = '0';} else{$eersteBericht = $_GET['eersteBericht'];}} else{$eersteBericht = '0';} // Als er iets mis is met var eersteBericht, dan hem op 0 zetten if (($eersteBericht >= $TotaalBerichten) || ($eersteBericht < 0)) ///////////DIT IS LIJN 60 {$eersteBericht = 0;} EDIT: translated to english If i modify it to: $TotaalBerichten=0; /////////////ADDED //Aantal berichten totaal if (!$ResultTotaalBerichten = @mysql_query("SELECT COUNT(1) FROM " . $db_prefix . "berichten")) {$foutmelding .= $Taal['errorConfiguratieFromDB'];} else {$TotaalBerichten = mysql_result($ResultTotaalBerichten, 0); $TotaalPaginas = ceil($TotaalBerichten / $aantalBerichtenPerPagina);} @mysql_free_result($ResultTotaalBerichten); echo $TotaalBerichten; //////////////////////////////////////////////////////////////////////////ADDED //Var eersteBericht is het eerste bericht if (isset($_GET['eersteBericht'])) {if (!is_numeric($_GET['eersteBericht'])) {$eersteBericht = '0';} else{$eersteBericht = $_GET['eersteBericht'];}} else{$eersteBericht = '0';} // Als er iets mis is met var eersteBericht, dan hem op 0 zetten if (($eersteBericht >= $TotaalBerichten) || ($eersteBericht < 0)) ///////////DIT IS LIJN 60 {$eersteBericht = 0;} The $TotaalBerichten is '0' while there IS a message in the database??? this is my code im getting an error message Notice: Undefined offset: 20 in C:\wamp\www\examples\ideas\new2.php on line 33 Code: [Select] <?php echo "<table>\n"; //Move through a CSV file, and output an associative array for each line ini_set("auto_detect_line_endings", 1); $current_row = 1; $d=0; $handle = fopen("widget.csv", "r"); while ( ($data = fgetcsv($handle, 10000, ",") ) !== FALSE ) { $number_of_fields = count($data); echo "<thead>\n<tr>"; if ($current_row == 1) { //Header line /* for ($c=0; $c < $number_of_fields; $c++) */ { $header_array[$d] = $data[$d]; echo "<th>" . $data[$d] . "</th>"; } echo "</tr>\n</thead>\n\n<tbody>"; } else { //Data line for ($c=1; $c < $number_of_fields; $c++) echo "<tr>"; { $data_array[$c] = $data[$c]; /* echo "<td>" . $data[$c] . "</td>"; */ } echo "</tr>\n"; } $current_row++; } fclose($handle); echo "</tbody>\n</table>"; echo $number_of_fields; echo "<br />"; echo $current_row; ?> this is my csv file Quote A,Airlie Beach,Andergrove,Alexandra,Armstrong Beach,Alligator Creek,,,,,,,,,,,,,, B,Bucasia,Blacks Beach,Beaconsfield,Bakers Creek,Balberra,Bloomsbury,Breadalbane,Ball Bay,Belmunda,,,,,,,,,, C,Cannonvale,Calen,Crystal Brook,Cremorne,Chelona,Campwin Beach,Cape Hillsborough,Conway,,,,,,,,,,, D,Dows Creek,Dumbleton,Dolphin Heads,,,,,,,,,,,,,,,, E,Eimeo,Eton,Erakala,,,,,,,,,,,,,,,, F,Foulden,Foxdale,Flametree,Farleigh,Freshwater Point,,,,,,,,,,,,,, G,Glen Isla,Glenella,,,,,,,,,,,,,,, ,, H,Homebush,Hampden,,,,,,,,,,,,, ,,,, I,,,,,,,,,,,,,,, ,,,, J,Jubilee Pocket,,,,,,,,,,,,,, ,,,, K,Kinchant Dam,Kolijo,Koumala,Kuttabul,,,,,,,,,,, ,,,, L,Laguna Quays,,,,,,,,,,,,,, ,,,, M,McEwens Beach,Mackay,Mackay Harbour,Mandalay,Marian,Mia Mia,Middlemount,Midge Point,Mirani,Moranbah,Mount Charlton,Mount Jukes,Mount Julian,Mount Marlow,Mount Martin,Mount Ossa,Mount Pelion,Mount Pleasant,Mount Rooper N,Narpi,Nebo,Nindaroo,North Eton,,,,,,,,,,,,,,, O,Oakenden,Ooralea,,,,,,,,,,,,,,,,, P,Palmyra,Paget,Pindi Pindi,Pinevale,Pioneer Valley,Pleystowe,Preston,Proserpine,,,,,,,,,,, Q,,,,,,,,,,,,,,,,,,, R,Racecourse,Richmond,Riordanvale,Rosella,Rural View,,,,,,,,,,,,,, S,St Helens Beach,Sandiford,Sarina,Seaforth,Slade Point,Shoal Point,Shute Harbour,Shutehaven,Strathdickie,Sugarloaf,Sunnyside,,,,,,,, T,Te Kowai,The Leap,,,,,,,,,,,,,,,,, U,,,,,,,,,,,,,,,,,,, V,Victoria Plains,,,,,,,,,,,,,,,,,, W,Wagoora,Walkerston,Woodwark,,,,,,,,,,,,,,,, X,,,,,,,,,,,,,,,,,,, Y,Yalboroo,,,,,,,,,,,,,,,,,, Z,,,,,,,,,,,,,,,,,,, Could anyone please help little stuck on why its causing this error. hi, can anyone tell me anything wrong with my coding as it keeps mentioned undefined index,id
Attached Files
tambahitem.php 5.08KB
1 downloads Google has failed me once again . I'm getting this error, which I can't find out how to fix: Here's the code: $Database_Factions = "factions"; $Database_Factions_1 = "Name"; $Database_FName_Num = 1; $searchmemberdata = mysql_query("SELECT " . $Database_Factions_1 . " FROM " . $Database_Factions . " WHERE " . $Database_Factions_1 . " LIKE '" . mysql_real_escape_string($_GET['name']) . "%' LIMIT 1"); $searchdata = mysql_fetch_row($searchmemberdata); echo($searchdata[$Database_FName_Num]); echo("<meta http-equiv='refresh' content='55;url=member.php?action=ViewFaction&name=" . $searchdata[$Database_FName_Num] . "' />"); I know my code is not optimized, I'm fixing it after i'm done with what i'm doing. Everytime $searchdata[$Database_FName_Num] is called, the error: Notice: Undefined offset: 1 comes out. Any help? Hi, I was wondering if someone can help me, I keep getting these errors. Notice: Undefined property: stdClass::$vOptionType in /default/commonFunctions.php on line 267 That is the line from the file. if($rsOptions[$j]->vOptionType=='colour_fromcsv' || $rsOptions[$j]->vOptionType=='size_fromcsv') I was wondering if someone could tell me what it means and possible point me in the right direction on how to fix the issue. Thanks, Jordan Hi,
I'm trying to read the 'code' value "2303" from the following XML.
This is currently held in a string called $result.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="x"> <response> <result code="2302"> <msg>Object exists</msg> <extValue> <value> <domain:name xmlns:domain="urn:ietf:params:xml:ns:domain-1.0" xsi:schemaLocation="urn:ietf:params:xml:ns:domain-1.0 domain-1.0.xsd"> google.co.uk </domain:name> </value> <reason>V094 Domain name exists already</reason> </extValue> </result> <trID> <clTRID>ABC-1234x5</clTRID> <svTRID>387210698x9</svTRID> </trID> </response> </epp>I have the following, but it is throwing me an error. I cant figure out what I'm doing wrong, as thought i had referenced it correctly. $xml = simplexml_load_file($result); $code = intval($xml->response->result['code']); //line 147 echo $code;Notice: Trying to get property of non-object in class.php on line 147 Warning: simplexml_load_file(): I/O warning : failed to load external entity Any help much appreciated. MoFish I have a form and a validation both on the same page, however I'm getting notices since I have undefined variables. How do I get around this? Notice: Undefined index: submit in C:\xampp\htdocs\5dollar\register.php on line 10 Notice: Undefined index: password in C:\xampp\htdocs\5dollar\register.php on line 12 Notice: Undefined index: repeatpassword in C:\xampp\htdocs\5dollar\register.php on line 13 Notice: Undefined index: paypalemail in C:\xampp\htdocs\5dollar\register.php on line 14 $submit = $_POST['submit']; $password = strip_tags($_POST['password']); $repeatpassword = strip_tags($_POST['repeatpassword']); $paypalemail = strip_tags($_POST['paypalemail']); Can you set php to header("Location: http://www.yoursiteshomepage.com"); if you encounter a php error or notice? I encountered one just now. i have no idea what i did and didn't fix or alter anything but i can't seem to recreate it to figure out what happenned. Just thinking about when i make my site live. while i am coding to find text between some html tags ,, am getting an error... Notice: Undefined offset: 1 in D:\xamp\xampp\htdocs\file\dash.php on line 48 my code is at line 47 and 48 is Code: [Select] preg_match('/<td class="trow1" rowspan="3" valign="top">(.*)<\/td> /',$dat,$regs); echo $etc=$regs[1]; i am thinking copy data from Code: [Select] </td> <td class="trow1" rowspan="3" valign="top"> Posts per day: <strong>6.03</strong><br /> Threads per day: <strong>3.78</strong><br /> Members per day: <strong>4.76</strong><br /> Posts per member: <strong>1.27</strong><br /> Replies per thread: <strong>0.6</strong> </td> </tr> this much Code: [Select] Posts per day: <strong>6.03</strong><br /> Threads per day: <strong>3.78</strong><br /> Members per day: <strong>4.76</strong><br /> Posts per member: <strong>1.27</strong><br /> Replies per thread: <strong>0.6</strong> I realize others have had problems with the undefined index issue, but I can't find any answer to my particular problem in any forum, anywhere. I have a form/script which uploads images with description for an artist site. There are 25 images available to upload (an artist profile image and 24 art images), and the images 1-19 upload just fine. All the images share exactly the same code. But when the processing script comes to image 20, it fails and I get the "undefined index" notice. Here is the processing code for image 19-20. Code: [Select] //There are a total of 20 other blocks of code above this one, //and they are all the same except for the image number. //Artimage19 Process Begin $artimage19 = $_FILES['artimage19']['name']; $file_size = $_FILES['artimage19']['size']; $file_temp = $_FILES['artimage19']['tmp_name']; $title19 = $_POST['title19']; $disptitle19 = stripslashes($title19); $medium19 = $_POST['medium19']; $dim19 = $_POST['dim19']; $price19 = $_POST['price19']; $file_basename = substr($artimage19, 0, strripos($artimage19, '.')); // strip extention $file_ext = substr($artimage19, strripos($artimage19, '.')); $allowed_extensions['ext']= array('jpeg','jpg','gif','png'); if(!$allowed_extensions){ echo "Artimage19 file extension not allowed."; }else{ $file_ext = strtolower($file_ext); $random = rand(0000, 9999); $new_file_name19 = $surname.$random. '.' .$file_ext; } if($file_size > MAX_SIZE*1024) { echo 'ARTIMAGE19 FILE SIZE TO LARGE<BR />'; } if(move_uploaded_file($file_temp, "$filepath/$new_file_name19")) { //echo '<h3>Upload Successful!</h3>'; } else { echo '<h3>ERROR IN UPLOADING ARTIMAGE19</h3>'; } //Artimage19 Process Ends //Artimage20 Process Begin $artimage20 = $_FILES['artimage20']['name']; $file_size = $_FILES['artimage20']['size']; $file_temp = $_FILES['artimage20']['tmp_name']; $title20 = $_POST['title20']; $disptitle20 = stripslashes($title20); $medium20 = $_POST['medium20']; $dim20 = $_POST['dim20']; $price20 = $_POST['price20']; $file_basename = substr($artimage20, 0, strripos($artimage20, '.')); // strip extention $file_ext = substr($artimage20, strripos($artimage20, '.')); $allowed_extensions['ext']= array('jpeg','jpg','gif','png'); if(!$allowed_extensions){ echo "Artimage20 file extension not allowed."; }else{ $file_ext = strtolower($file_ext); $random = rand(0000, 9999); $new_file_name20 = $surname.$random. '.' .$file_ext; } if($file_size > MAX_SIZE*1024) { echo 'ARTIMAGE20 FILE SIZE TO LARGE<BR />'; } if(move_uploaded_file($file_temp, "$filepath/$new_file_name20")) { //echo '<h3>Upload Successful!</h3>'; } else { echo '<h3>ERROR IN UPLOADING ARTIMAGE20</h3>'; } //Artimage20 Process Ends Artimage19 uploads just fine, but Artimage20 fails. The $filepath is set correctly, as it uploads all previous image files. The code for the submitting code is fine also. Here is the code that submits the data. Code: [Select] //The form header is below <form action="pdregisterres.php" method="POST" enctype="multipart/form-data" onSubmit="return checkrequired(this)"> //there are 18 others above this plus one for an artist profile image <tr><td colspan = "2"><hr></td></tr> <tr><td align = "left">Art Image 19:</td><td align = "left"><input type = "file" name = "artimage19"></td></tr> <tr><td align = "left">Title:</td><td align = "left"><input type = "text" name = "title19"></td></tr> <tr><td align = "left">Medium:</td><td align = "left"><input type = "text" name = "medium19"></td></tr> <tr><td align = "left">Dimensions:</td><td align = "left"><input type = "text" name = "dim19"></td></tr> <tr><td align = "left">Price:</td><td align = "left"><input type = "text" name = "price19"></td></tr> <tr><td colspan = "2"><hr></td></tr> <tr><td align = "left">Art Image 20:</td><td align = "left"><input type = "file" name = "artimage20"></td></tr> <tr><td align = "left">Title:</td><td align = "left"><input type = "text" name = "title20"></td></tr> <tr><td align = "left">Medium:</td><td align = "left"><input type = "text" name = "medium20"></td></tr> <tr><td align = "left">Dimensions:</td><td align = "left"><input type = "text" name = "dim20"></td></tr> <tr><td align = "left">Price:</td><td align = "left"><input type = "text" name = "price20"></td></tr> For some reason that I can't get, the form stops processing after Artimage19 and gives me this: Notice: Undefined index: artimage20 in /home/www/artistsofeureka.info/members/pdregisterres.php on line 1046 I also get the error message: ERROR IN UPLOADING ARTIMAGE20 I get this for images 20-24. Since the code for all image processing is exactly the same (except for image #), I can't see why it stops at #19. These images are being uploaded to a folder on my server and a mysql db. Images up to #19 upload just fine. Any comments, questions or helpful advice? |