PHP - Hide Notice Coming From Error Reporting.
I am using the classic
Code: [Select] ini_set("display_errors","2"); ERROR_REPORTING(E_ALL); but I am getting a notice that is posting on my page. I preffer not to remove the reporting yet since the site is still new and is there any way I can hide the notice but keep the fail errors the error is Code: [Select] Notice: Undefined index: HTTPS in /var/www/website/visitors.php on line 20 line 20 is Code: [Select] if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} Similar TutorialsI want to log my errors to a log file but it isn't working. I get the error displayed on the screen but the file is not written to. The file permissions are set to 777 to make things easy. Error reporting is on for development only. Any advice on why I cannot write to the file? It's an apache server. Is there a trick to getting the file path correct relative to my front controller? Also, if I use error_log to send the error to my email address, it works. ini_set('error_reporting', E_ALL | E_STRICT); ini_set('display_errors', true); error_log("You messed up!", 3, '/var/www/vhosts/domain.com/httpdocs/framework/errors.txt'); When I use ini_get to check my error_reporting level, I get a weird value ( 4983 ) that I can't find anywhere by googling. Also not on the list of possible levels here ( http://itech.hubpages.com/hub/php-error_reporting ) .. does anyone know how to determine what exactly this level is? Thanks! im getting this error when i run a script mysql_query(): supplied argument is not a valid MySQL-Link resource what do i have to do to echo out the actual error and what line its on like this Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/www/ikhelper.freehostia.com/globinc/loginfunc.php on line 87 iv tried inserting error_reporting(E_ERROR | E_WARNING | E_PARSE); and error_reporting(-1); but doesnt output any error I have been working on this awhile (the perfect PHP error handling for my coding style). I have tried to set it up as: Code: [Select] <?php error_reporting(E_ALL & E_STRICT & ~(E_NOTICE)); ?> I want this to show me E_ALL errors, E_STRICT errors, and NOT show me E_NOTICE. Is this the right way to set that up, or am I doing something wrong. I haven't used E_STRICT before but I am anxious to see what kind of errors that have it showing since I haven't messed with it before. Thanks again. Hi Guys Completely Stuck by this one. Using the code below, when I go to the page I am getting a completely blank page (even though I have Error Reporting on. Can anybody tell me where I have gone wrong? Code: [Select] <?php ini_set ('display_errors', 1); error_reporting(E_ALL); ?> <?php session_start(); include_once('includes/connect_inc.php'); include_once('functions/reg_functions.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/trade-bidz.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Trade-Bidz Coming Soon...</title> <!-- InstanceEndEditable --> <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> <link href="style/trade-bidz.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" language="JavaScript"> <!-- Copyright 2006,2007 Bontrager Connection, LLC // http://bontragerconnection.com/ and http://www.willmaster.com/ // Version: July 28, 2007 var cX = 0; var cY = 0; var rX = 0; var rY = 0; function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;} function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;} if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; } else { document.onmousemove = UpdateCursorPosition; } function AssignPosition(d) { if(self.pageYOffset) { rX = self.pageXOffset; rY = self.pageYOffset; } else if(document.documentElement && document.documentElement.scrollTop) { rX = document.documentElement.scrollLeft; rY = document.documentElement.scrollTop; } else if(document.body) { rX = document.body.scrollLeft; rY = document.body.scrollTop; } if(document.all) { cX += rX; cY += rY; } d.style.left = (cX+10) + "px"; d.style.top = (cY+10) + "px"; } function HideContent(d) { if(d.length < 1) { return; } document.getElementById(d).style.display = "none"; } function ShowContent(d) { if(d.length < 1) { return; } var dd = document.getElementById(d); AssignPosition(dd); dd.style.display = "block"; } function ReverseContentDisplay(d) { if(d.length < 1) { return; } var dd = document.getElementById(d); AssignPosition(dd); if(dd.style.display == "none") { dd.style.display = "block"; } else { dd.style.display = "none"; } } //--> </script> </head> <body> <div id="header"> <div id="login_form"> <?php //if(!isset($_SESSION['logname'])) //{ //include_once('includes/mini_login_inc.php'); //} //else //{ //include_once('includes/logout_inc.php'); //} ?> </div> <img src="images/logo.jpg" width="300" /></div> <div id="nav_head"><ul><li>Buying</li><li>Selling</li><li>Contact Us</li><li>Terms</li><li>My Trade-Bidz</li></ul></div> <div id="content"><!-- InstanceBeginEditable name="content" --> <form name="add_lot" action="add_vehicle.php" method="post"> <table> <tr><td>Reg Number</td><td><input name="veh_reg" width="10" maxlength="10"/><img src="images/search_glass.jpeg" width="50" onclick="getVehData()" /> <?php if (isset($message)) { echo ('<br />'.$message.); } ?> </td></tr> </table> </form> </body> <!-- InstanceEnd --></html> 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 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. Notice: Undefined index: username in C:\wamp\www\LogInSystem\login.php on line 2 Notice: Undefined index: password in C:\wamp\www\LogInSystem\login.php on line 3 Help me to change this error Code: [Select] <?php $username = $_POST['username']; ERROR IS IN THIS LINE $password = $_POST['password']; ERROR IS IN THIS LINE if ($username&&$password){ $connect = mysql_connect ("localhost", "root","") or die ("could not connect"); mysql_select_db ("login") or die ("could not find db"); } else { die ("Please enter username and password!");} ?> Hello i am new to this forum and coding. I am trying to fix a auto torrent downloading script which is php and curl. I have been stucked with Undefined offset error. Your help will be very appretiated, thanks. Starting download: Mp3-data1 Notice: Undefined variable: temp in /var/www/html/torrents/bgrahul2.php on line 338 Array ( => HTTP/1.1 200 OK Server: Transmission Content-Type: application/json; charset=UTF-8 Date: Wed, 21 Sep 2011 19:58:44 GMT Content-Length: 49 {"arguments":{"torrents":[]},"result":"success"} [1] => ) Marked those lines to bold Quote $result = callTransmission(array("filename" => "/var/www/html/donofwarez/xxx/torrents/$torrentfile", "download-dir" => "/home/Downloads/$title/"), "torrent-add", $arr[1]); callTransmission(array("seedRatioLimit" => 50, "seedRatioMode" => 1), "torrent-set", $arr[1]); /* echo "<pre>"; print_r($result); echo "</pre>"; */ if (preg_match('/"percentDone":[0-9.]+/i', $result[0], $matches)) $temp = str_replace('"id":', "", $matches[0]); // $temp="hlDr1wqu2ONtM3McVGHoVzfrkp2UgUcGwDt66IuxAe0LBkru"; $id[0] = $temp; //***OMG! We need the ids as integers! *** foreach ($id as $key => $value) { $id[$key] = (int) $value; } Help me solve in error Notice: Undefined index: ch1 in C:\wamp\www\latest\library\bookdb.php on line 3 It comes when i uncheck any checkbox Thank U in advance Im having this error and have the not even the slightest clue on how to solve it... Code: [Select] Notice: Undefined offset: 2 in C:\wamp\www\updat5.php on line 146 <?php $picture = array(); while($row = mysql_fetch_assoc($result)) { $id = $row['id']; $picture = array(); switch ($row['icon']) { case 1: $picture[$id] = '<img src="img/apple.gif" title="apple" alt="apple" />'; echo $picture[$id]; break; case 2: $picture[$id] = '<img src="img/banana.gif" title="banana" alt="banana" />'; echo $picture[$id]; break; case 3: $picture[$id] = '<img src="img/orange.gif" title="orange" alt="orange" />'; echo $picture[$id]; break; default: $picture[$id] = ''; echo $row['icon'] . " is something other than 1 2 or 3"; break; } } ?> <hr> <?php echo $picture[2]; ?> And line 146 is: echo $picture[2]; My next post will be the full code if needed incase the error I have currently cant be fixed with the current snippet/block i posted. Code: [Select] Notice: Undefined variable: page in C:\Program Files (x86)\EasyPHP5.2.10\www\admin.php on line 119 That line is: <?php session_start(); $_SESSION['prev_page'] = $_SERVER['REQUEST_URI']; if (!session_is_registered('username')) { header("location:login.php"); } ?> <hr> <style type="text/css"> table.gridtable { color:#333333; border-width: 1px; border-color: #666666; border-collapse: collapse; width: 100%; } table.gridtable th { border-width: 1px; padding: 1px; border-style: solid; border-color: #666666; background-color: #dedede; } table.gridtable td { border-width: 1px; padding: 1px; border-style: solid; border-color: #666666; } .valid { border-width: 1px; padding: 1px; border-style: solid; border-color: #666666; background-color: transparent; } </style> </div> <div class="newsJustify"> <script type="text/javascript"> function checkall(delchk) { for (i = 0; i < delchk.length; i++) delchk[i].checked = true; } </script> <script type="text/javascript"> function uncheckall(delchk) { for (i = 0; i < delchk.length; i++) delchk.checked = false; } </script> <script language="JavaScript"> function loadPage(list) { location.href=list.options[list.selectedIndex].value } </script> <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("chat") or die(mysql_error()); if (isset($_POST['del'])) { for ($count = 0; $count < count($_POST["delchk"]); $count++) { $delete = $_POST["delchk"][$count]; $query = "DELETE FROM members_shouts WHERE id = '$delete'"; $result = mysql_query($query); if (!$result) { die("Error deleting accounts! Query: $query<br />Error: " . mysql_error()); } } } $data = mysql_query("SELECT * FROM `members_shouts`") or die(mysql_error()); $rows = mysql_num_rows($data); if (isset($_GET['limit'])) { $page_rows = $_GET["limit"]; if ($page_rows == '') { $page_rows = 5; // no double quotes (int) } elseif ($page_rows == 'all') { $page_rows = $rows; } else { $page_rows = $_GET['limit']; /* validate this */ } if (!isset($_GET['pagenum'])) { $page = 1; } else { $page = (int) $_GET['pagenum']; } } else { $page_rows = 10; } ?> <?php $max_pages = ceil($rows / $page_rows); $last = ceil($rows / $page_rows); $pagenum = ($page && $page > 0 && $page <= $last) ? $page : 1; $max = 'limit ' . ($pagenum - 1) * $page_rows . ',' . $page_rows; $data_p = mysql_query("SELECT * FROM members_shouts $max") or die(mysql_error()); ?> <?php $result = mysql_query("SELECT * FROM members_shouts"); if (mysql_num_rows($result) > 0) { ?> <span style="float: left;margin-left: 2px;"> <form> <select name="file" size="1" onchange="loadPage(this.form.elements[0])" target="_parent._top"> <option value="" <?php if ($page_rows == 0) { echo 'selected'; } ?>>Select Limit</option> <option value="?limit=9" <?php if ($page_rows == 9) { echo 'selected'; } ?>>9</option> <option value="?limit=15" <?php if ($page_rows == 15) { echo 'selected'; } ?>>15</option> <option value="?limit=30" <?php if ($page_rows == 30) { echo 'selected'; } ?>>30</option> <option value="?limit=all" <?php if ($page_rows == 'all') { echo 'selected'; } ?>>All</option> </select> </form> </span> <span style="float: right;margin-top: 2px;margin-right: 2px;"> <center> <?php if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&limit={$page_rows}'>First</a> "; echo " | "; echo " "; $previous = $pagenum - 1; $current = $pagenum; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous&limit={$page_rows}'>$previous</a> "; echo " | "; } echo "$pagenum"; if ($pagenum == $last || $last == 0) { } else { $next = $pagenum + 1; echo " | "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$next&limit={$page_rows}'>$next</a> "; echo " "; echo " | "; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$last&limit={$page_rows}'>Last</a> "; } ?> </center> </span> <style type="text/css"> .clear2 { clear:both; height:0px; overflow:hidden; } </style> <div class="clear2"></div> <hr> <?php echo "<table class=\"gridtable\"> <thead> <tr> <th align=\"center\" scope=\"col\">user</th> <th align=\"center\" scope=\"col\">message</th> <th align=\"center\" scope=\"col\">when</th> <th align=\"center\" scope=\"col\">Delete?</th> </tr> </thead> <tbody>"; echo "<form name = 'myform' action='' method='post'>"; ?> <?php while ($info = mysql_fetch_array($data_p)) { echo "<tr align=\"center\">"; echo "<td class=\"valid\" >" . $info['user'] . "</td>"; echo "<td class=\"valid\" >" . $info['message'] . "</td>"; echo "<td>" . $info['when'] . "</td>"; echo '<td><input type="checkbox" id="delchk" name="delchk[]" value="' . $info['id'] . '" /></td>'; echo "</tr>"; } echo "</tbody>"; echo "</table>"; echo "<hr>"; echo "<input type='submit' name = 'del' value='Delete Selected'></form>"; echo "<input type='button' onclick='checkall(document.myform[\"delchk\"]);' value='Select All'>"; echo "<input type='button' onclick='uncheckall(document.myform[\"delchk\"]);' value='Deselect All'>"; echo "<hr>"; ?> <?php } else { // No rows were found ... echo '<center>No logged accounts.</center><hr>'; } ?> </hr> The line its refferring too is: $pagenum = ($page && $page > 0 && $page <= $last) ? $page : 1;[/QUOTE] in this block: $max_pages = ceil($rows / $page_rows); $last = ceil($rows / $page_rows); $pagenum = ($page && $page > 0 && $page <= $last) ? $page : 1; $max = 'limit ' . ($pagenum - 1) * $page_rows . ',' . $page_rows; $data_p = mysql_query("SELECT * FROM members_shouts $max") or die(mysql_error()); [/i] Hi
I'm having a strange error with this code and i get it working properly
function CheckLoginInDB($username,$password) { if(!$this->DBLogin()) { $this->HandleError("Erro na ligação à Base de Dados!"); return false; } $username = $this->SanitizeForSQL($username); $nresult = mysql_query("SELECT * FROM utilizador WHERE utilizador = '$username'", $this->connection) or die(mysql_error()); // check for result $no_of_rows = mysql_num_rows($nresult); if ($no_of_rows > 0) { $nresult = mysql_fetch_array($nresult); $salt = $nresult['salt']; echo $salt; $encrypted_password = $nresult['password']; $hash = $this->checkhashSSHA($salt, $password); echo $hash; } $qry = "Select idutilizador, nome, email from utilizador where utilizador='$username' and password='$hash'"; $result = mysql_query($qry,$this->connection); if(!$result || mysql_num_rows($result) <= 0) { $this->HandleError("Erro: Utilizador ou password errados"); return false; } $row = mysql_fetch_assoc($result); $_SESSION['idutilizador'] = $row['idutilizador']; $_SESSION['name_of_user'] = $row['nome']; $_SESSION['email_of_user'] = $row['email']; return true; }This is my table Field Type Collation Null Key Default Extra Privileges Comment I'm trying to develop a Joomla plugin for 1.6/1.7 and from what I've read, future versions are supposed to be php E~STRICT compliant. I know that doesn't mean I have to fix this since it is just a notice, but I am curious how one would hide the error. Code: [Select] $task_array = explode('.', JRequest::getVar('task')); # Splits article.save $task = $task_array[1]; #This is line 58 I know it happens because $task_array is empty, but how can i wrap that in something to stop this Notice error? I've tried !empty() but that doesn't work.
First let me explain my code. This is later included in project_status.php] . In project_status.php] , I have included another file project_status_app.php which contains a HTML form.
<?php include 'inc_fn_header_and_menu.php'; function includeFile($file,$variable) { $var = $variable; include($file); } if (isset($_GET['id']) && $_GET['id']!="") { $pid = $_GET['id']; $_SESSION['pidForApproval'] = $_GET['id']; $query = 'SELECT * FROM `profile` WHERE pid ='.'\''.$pid.'\''; $result=mysqli_query($db,$queryToRetrievePP) or die("There are no records to display ... \n" . mysqli_error()); foreach ($result as $row) { $status = $row['status']; } } ...........some PHP and HTML code....... <div id="customerPurchaseApprovalForm"> <?php echo '<p>APPROVAL FOR CUSTOMER PURCHASE</p>'; $discountApprovalStatus = "Granted"; if ($discountApprovalStatus == "Granted") { includeFile("project_status_app.php",$highestannualvalue); } else { //......... } In project_status_app.php I am attempting to retrieve pidForApproval from the $_SESSION array. <?php // put your code here UPDATE `pp` SET `customer_purchase_remarks` = 'hahaha' WHERE `pp`.`id` = 207; if ($_SERVER['REQUEST_METHOD'] == 'POST') { include '../../inc/fastlogin.php'; $sql = "UPDATE pp SET customer_purchase_remarks ='{$_POST['remarkstxt']}' WHERE pp.pid='{$_SESSION['pidForApproval']}'"; $result = mysqli_query ( $fastdb, $sql ) ; if (mysqli_affected_rows($fastdb) != 1) { $_SESSION['err_cpa_rmks'] = "<p>Error while updating WHERE id='{$_SESSION['pidForApproval']}'</p>"; //echo "<p>Error while updating WHERE id='{$_POST['pidForApproval']}'</p>".mysqli_error($fastdb); } else { $_SESSION['suc_cpa_rmks'] = "<p>Records was updated successfully.</p>"; //echo "Records was updated successfully."; } header ("location: project_status.php?id="$_SESSION['pidForApproval']); exit(); } ?> When I load project_status.php, project_status_app.php is supposed to display the form. Once the user fills in the form the and the submit button has been pressed, the UPDATE statement is supposed to run and then it is supposed to navigate back to project_status.php?id=FA142. But the update is failing and the when the project_status.php is loaded back, the url looks like this http://localhost/fast/project_status.php?id= . The id is empty. It is supposed to be something like this http://localhost/fast/project_status.php?id=FA142. With the id being populated at the header ("location: project_status.php?id=".$_SESSION['pidForApproval']);
Missing some information. Hey, So what im trying to do is put my database variables into a session array. So this is what im trying to accomplish... $_SESSION['Name_of_Row'] = $value This is the script I wrote: Code: [Select] Function setupSession(){ session_start(); $query = "SELECT * FROM users WHERE u_id ='{$this->u_id}'"; $result = mysql_query($query); $row = mysql_fetch_array($result); foreach($row as $key => $value){ if(!empty($value)){ $_SESSION[$key] = $value; } } } When that runs I get the following warning. Can anyone tell me what this means and how to fix it? Error: Notice: Unknown: Skipping numeric key 0 in Unknown on line 0 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 I'm pretty new to php, and I'm making everything on my web site php-driven. If a warning or error occurs, I don't want the user to see it. Primarily because some of the messages give away hidden file paths that I don't want anyone to know about. I would prefer to redirect all warnings and errors to a log file. If that's not possible, I would like to just hide them. I've googled and can't really find what I'm looking for. PHP.net's manual describes something called display_errors, which doesn't sound bad, but then it says: "Note: This is a feature to support your development and should never be used on production systems (e.g. systems connected to the internet). " http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors And I read you can use the @ before any expressions, which I will do if I must, but I don't like it because it's messy. I'd rather there was one thing I could set to say "send all warnings and errors here". Any advice? Thank you! Hello everyone, I have a messaging site where I have an email generated every night to report new activity on my site. The way it is currently set up, I have each message reply attached to the previous message, such as quoting the original text in an email message. Each string of messages in my database has one common field ("string"), but each new reply has a different message ID field in the database ("messid"). When each new message and reply is created the "reported" field in my database has a default value of n, meaning that it has not been reported yet. At the end of the day, when the email is generated, the reported field is then updated to y, meaning that it HAS been reported. The problem that I'm having now, is that I'm getting several of the same messages in every report. I am using the following code to select each unreported message from the database to generate my report: Code: [Select] <?php $result = mysql_query("SELECT `to`,`studentname`,`staffname`,`subject`,`message`,`date` FROM caresa6_$acct.allmsgs WHERE reported = 'n' ORDER BY `messid` ASC") or die (mysql_error()); ?> Basically, I need to know how to select only the most recent unreported message within each string of messages. For example, now if there is a new message: "Hello there." Then a reply from the recipient: "Hi! How are you?" Then another reply from the original sender: "I am fine." My report will look like this: ___________ New Message: "Hello there." ------------------ Reply: "Hi! How are you?" ------------------ Reply: "I am fine." ------------------ ___________ New Message: "Hello there." ------------------ Reply: "Hi! How are you?" ------------------ ___________ New Message: "Hello there." ------------------ So I am getting carbon copies of every new message every time someone replies. I want to only select the most recent message so that my report only reads: ___________ New Message: "Hello there." ------------------ Reply: "Hi! How are you?" ------------------ Reply: "I am fine." ------------------ Thanks in advance. hey all,
I've finally took a leap towards the brighter side of coding.. and Ive started to convert my code from php to opp pdo ect..
However the errors Ive been through my cms's and well anything to do with inserting into a database is rather confusing..
ERRORS such as invalid parameter number,.
What does this mean?
Here's the code that im getting the error from:
<?php //if form has been submitted process it if(isset($_POST['submit'])){ $_POST = array_map( 'stripslashes', $_POST ); //collect form data extract($_POST); //very basic validation if($title ==''){ $error[] = 'Please enter the title.'; } if($short_desc ==''){ $error[] = 'Please enter a short description.'; } if($full_desc ==''){ $error[] = 'Please enter a full description.'; } if(!isset($error)){ try { //insert into database $stmt = $handler->prepare('INSERT INTO calendar_event (title,short_desc,full_desc,date) VALUES (:title, :short_desc, :full_desc, :date)') ; $stmt->execute(array( ':title' => $title, ':short_desc' => $short_desc, ':ful_desc' => $full_desc, ':date' => date('Y-m-d') )); //redirect to index page header('Location: index.php?action=added'); exit; } catch(PDOException $e) { echo $e->getMessage(); } } } //check for any errors if(isset($error)){ foreach($error as $error){ echo '<p class="error">'.$error.'</p>'; } } ?> <form action='' method='post'> <table class="admin_table_defaults"> <tr> <th width="10px">Title</th> <th width="200px">Date</th> <th width="200px"> </th> <th></th> </tr> <tr> <td><input type='text' name='title' value='<?php if(isset($error)){ echo $_POST['title'];}?>'></td> <td><input type='date' name='date' value='<?php if(isset($error)){ echo $_POST['date'];}?>'></td> <td><td> </tr> </table> <table class="admin_table_defaults"> <tr> <th style="text-align:left;"> Short Description <span class="small_text"> : NB - Please avoid using images, align properties, stick to text format. <br/><b style="background:#fff;font-size:14px;">Note : There's a character max of 100 characters for this field</b></span></th> </tr> <tr> <td><textarea name='short_desc' cols='60' rows='10' ><?php if(isset($error)){ echo $_POST['short_desc'];}?></textarea></td> </tr> <tr> </table> <table class="admin_table_defaults"> <tr> <th style="text-align:left;"> Full Description: <span class="small_text"></th> </tr> <tr> <td><textarea name='full_desc' cols='60' rows='10'><?php if(isset($error)){ echo $_POST['full_desc'];}?></textarea></td> </tr> <tr> <td><input class="admin_submit_btn"type='submit' name='submit' value='Submit'></td> </tr> <tr> </table> </tr> </table> </form>Any help will be greatly appreciated Thanks in advance.. |