[PHP] Problem with code...
Hi everyone, Have a question about this block of code ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Jason Pruim li...@pruimphotography.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with code...
On 2011-10-06, at 6:28 PM, Jason Pruim wrote: ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Hi there. First thought is perhaps it is not getting a value for paymentMethod and if it doesn't exist, will the line still get added? I would always check to see if every post variable isset, before adding the line. Can write a default line in its place if missing. George Langley Interactive Developer RIP, Mr. Jobs.
Re: [PHP] Problem with code...
Jason Pruim li...@pruimphotography.com On Oct 6, 2011, at 9:04 PM, George Langley wrote: On 2011-10-06, at 6:28 PM, Jason Pruim wrote: ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Hi there. First thought is perhaps it is not getting a value for paymentMethod and if it doesn't exist, will the line still get added? I would always check to see if every post variable isset, before adding the line. Can write a default line in its place if missing. The variable is being set with a default value of nothing else... But for some reason it's not bringing it through when the form is submitted... Any other ideas? hehe :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with code...
On Thu, Oct 6, 2011 at 7:29 PM, Jason Pruim li...@pruimphotography.comwrote: Jason Pruim li...@pruimphotography.com On Oct 6, 2011, at 9:04 PM, George Langley wrote: On 2011-10-06, at 6:28 PM, Jason Pruim wrote: ?PHP //SETUP VARIABLES $mailTo = li...@pruimphotography.com; $mailFrom = li...@pruimphotography.com; //These 2 can be changed IF you know what you are doing and why! $returnPath = $mailFrom; $replyTo = $mailFrom; $mailSubject = New Convention registration!; $message = ; //DO NOT CHANGE UNDER PENALITY OF BEING SLAPPED WITH A WET NOODLE!!! $headers = From: .$mailFrom.\n; $headers .= Return-Path: .$returnPath.\n; $headers .= Reply-To: .$replyTo.\n; function send_email($mailTo, $mailSubject, $mailMessage, $headers) { if(mail( $mailTo, $mailSubject, $mailMessage, $headers )) { $message = Thank you for registering!; }else { echo There was an issue with your registration.. Please try again later; } }//Close Function if(!empty($errorCount)) { }else { //Build Email message $mailmessage = Full Name: . $_POST['firstname'] . . $_POST['lastname'] . \n\n; $mailmessage .= Address: . $_POST['address'] . \n\n; $mailmessage .= City, State, Zip: . $_POST['city'] . . $_POST['state'] . . $_POST['zip'] . \n\n; $mailmessage .= Phone: . $_POST['phone'] . \n\n; $mailmessage .= Email address: . $_POST['email'] . \n\n; if($_POST['affiliation'] == NFBOther) { $mailmessage .= Chapter Affiliation: . $_POST['other'] . \n\n; }else{ $mailmessage .= Chapter Affiliation: . $_POST['affiliation'] . \n\n; } if($_POST['person'] ==Other){ $mailmessage .= Who will pick up the ticket? . $_POST['Pfirstname'] . . $_POST['Llastname'] . \n\n; }else{ $mailmessage .= Who will pick up the ticket? I will pick it up my self! \n\n; } $mailmessage .= Payment Method: . $_POST['paymentMethod']; send_email($mailTo, $mailSubject, $mailmessage, $headers); } ? Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Anyone have any ideas? I'm stumped Hi there. First thought is perhaps it is not getting a value for paymentMethod and if it doesn't exist, will the line still get added? I would always check to see if every post variable isset, before adding the line. Can write a default line in its place if missing. The variable is being set with a default value of nothing else... But for some reason it's not bringing it through when the form is submitted... Any other ideas? hehe :) Have you tested with the same payment method to see if somewhere in your code or a hiccup in the server is causing the problem? Does that happen to any or certain payment method (including blank entry)? I'm guessing it may happen with only certain payment method. From the line if(!empty($errorCount)) {, I presume you have a mechanism in place to sanitize and validate inputs? I'd suggest you start troubleshooting from there. If this is still development phase, try to bypass that mechanism for a quick confirmation that is causing the problem. Regards, Tommy
Re: [PHP] Problem with code...
On Thu, Oct 6, 2011 at 7:28 PM, Jason Pruim li...@pruimphotography.com wrote: Have a question about this block of code I'm not seeing anything immediately standing out as a problem. Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Can you see if the last line is actually in $mailmessage before sending the email? Maybe it's somehow getting truncated during the mail step. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fwd: [PHP] Problem with code...
On Thu, Oct 6, 2011 at 7:28 PM, Jason Pruim li...@pruimphotography.com wrote: Have a question about this block of code I'm not seeing anything immediately standing out as a problem. Sometimes... It is dropping the last $mailmessage line... The payment method in the actual email it sends... Can you see if the last line is actually in $mailmessage before sending the email? Maybe it's somehow getting truncated during the mail step. *Update:* I just noticed this. The last line has no \r\n termination. I'm thinking that may be necessary for some mailers/transports/etc? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with code between 4.3.4rc1 upgrading to php 4.4.2
Hello, About 2 years ago i setup Apache/1.3.28 (Unix) PHP/4.3.4RC1 mod_ssl/2.8.15 OpenSSL/0.9.7c and mysql on BSD Unix and did up some simple php enabled web pages to add / remove /edit / search entries to a 1 table mysql database to keep track of abuse complaints for my company. This week Ive had to migrate all this to new Solaris 10 box which i installed Apache/1.3.34 (Unix) PHP/4.4.2 mod_ssl/2.8.25 OpenSSL/0.9.8a with mysql . The problem im have is that when i go to search for an entry through the web interface...it pulls ALL entries in the database and displays them instead of the ones im searching for. When i go to add an entry ...it actually enters a entry to mysql ...but its empty. If i try to do an edit on an existing entry ...the form doesnt pull the existing entries from the database to be edited...Im thinking its probably something with my syntax that im using is no longer valid with the new versions of php4. Does anyone have any thoughts or suggestions ?? I can submit some of the code for everyone to look at .. Any help is greatly appreciated -- -- Brent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problem with code between 4.3.4rc1 upgrading to php 4.4.2
On Thu, Feb 09, 2006 at 04:04:49PM -0500, Brent wrote: Hello, About 2 years ago i setup Apache/1.3.28 (Unix) PHP/4.3.4RC1 mod_ssl/2.8.15 OpenSSL/0.9.7c and mysql on BSD Unix and did up some simple php enabled web pages to add / remove /edit / search entries to a 1 table mysql database to keep track of abuse complaints for my company. This week Ive had to migrate all this to new Solaris 10 box which i installed Apache/1.3.34 (Unix) PHP/4.4.2 mod_ssl/2.8.25 OpenSSL/0.9.8a ... ?? I can submit some of the code for everyone to look at .. Any help is greatly appreciated This sounds like the old version had register_globals [1] set to on. You'll want to change your code [2] so it works with it off, like: $_GET['variable']; or $_POST['variable']; It is strongly advisable to keep it off. [1] http://php.net/register_globals [2] http://php.net/language.variables.predefined Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with code
On Dec 5, 2004, at 9:05 PM, Richard Kurth wrote: I am having a problem with the code below it provides the first page with out any problem but when I select the next page it shows all the results from the first page and the results from the second page. It does the same thing on the third page also. I have been looking at it for two days and can not fined the error in the code ?php include(include/common.php); include($config[template_path]/user_top.html); I don't see where you set $page. And I'm betting that you don't. Variables are not persistent from one page-load to the next. try adding this line in here: $page = $_GET['page']; // If current page number, use it // if not, set one! if(!isset($page)){ $page = 1; } else { $page = $page; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with code
On Sun, 5 Dec 2004 21:05:12 -0800, Richard Kurth [EMAIL PROTECTED] wrote: I am having a problem with the code below it provides the first page with out any problem but when I select the next page it shows all the results from the first page and the results from the second page. It does the same thing on the third page also. I have been looking at it for two days and can not fined the error in the code It's probably the LIMIT clause in your sql query. Try printing the sql query on the page and check the limit. Or use one of the existing pagination classes from PEAR: http://pear.php.net/package-search.php?pkg_name=page -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with code
I am having a problem with the code below it provides the first page with out any problem but when I select the next page it shows all the results from the first page and the results from the second page. It does the same thing on the third page also. I have been looking at it for two days and can not fined the error in the code ?php include(include/common.php); include($config[template_path]/user_top.html); // If current page number, use it // if not, set one! if(!isset($page)){ $page = 1; } else { $page = $page; } // Define the number of results per page $max_results = $config['listings_per_page']; // Figure out the limit for the query based // on the current page number. $from = (($page * $max_results) - $max_results); //Process all the search results to create the sql if($searchRule == or){ $cond = OR; } else $cond = and; //the main sql statment $sql = 'SELECT * FROM listing '; //the sql statment required to set the total number of pages $sql1 = 'SELECT COUNT(*) as Num FROM listing '; if($state != || $type != || $county != || $price != ){ $sql .= WHERE ; $sql1 .= WHERE ; if($state != ){ $sql .= state = '. $state .'; $sql1 .= state = '. $state .'; if($state != || $type != || $county != || $price != ){ $sql .= $cond ; $sql1 .= $cond ; } } if($type != ){ $sql .= type = '. $type .'; $sql1 .= type = '. $type .'; if($state != || $type != || $county != || $price != ) { $sql .= $cond ; $sql1 .= $cond ; } } if($county != ){ $sql .= county = '. $county .'; $sql1 .= county = '. $county .'; if($state != || $type != || $county != || $price != ){ $sql .= $cond ; $sql1 .= $cond ; } } if($Pricerange != ){ if($Pricerange==range1){ $Price1=0; $Price2=10; $simbale==; $sql .= price = '. $Price2.'; $sql1 .= price = '. $Price2.'; } if($Pricerange==range2){ $Price1=10; $Price2=15; $sql .= (price '. $Price1.' OR price = '. $Price2.'); $sql1 .= (price '. $Price1.' OR price = '. $Price2.'); } if($Pricerange==range3){ $Price1=15; $Price2=20; $sql .= (price '. $Price1.' OR price = '. $Price2.'); $sql1 .= (price '. $Price1.' OR price = '. $Price2.'); } if($Pricerange==range4) {$Price1=20; $Price2=25; $sql .= (price '. $Price1.' OR price = '. $Price2.'); $sql1 .= (price '. $Price1.' OR price = '. $Price2.'); } if($Pricerange==range5) {$Price1=25; $Price2=30; $sql .= (price '. $Price1.' OR price = '. $Price2.'); $sql1 .= (price '. $Price1.' OR price = '. $Price2.'); } if($Pricerange==range6) {$Price1=30; $Price2=; $sql .= price = '. $Price1.'; $sql1 .= price = '. $Price1.'; }} $sql .= LIMIT . $from . , . $max_results; } $result=safe_query($sql); while ($row = mysql_fetch_array($result)){ extract($row); ? div align=center table border=0 width=631 height=1 cellpadding=0 cellspacing=0 tr td width=81 height=1 bgcolor=#60A0F8font color=#FFspan class=contentsmallListing/spanspan class=contentbold #? echo$listingId?/span/fontimg hspace=0 src=images/user_photos/thumb_5000_1.jpg border=0 width=83 height=50br /td center td width=401 height=1textarea cols=45 rows=6? echo$descr1?/textarea br a href=more_results.php?listingId=? echo$listingId?searchlistingid=yes more info.../a/td td width=127 height=1span class=contentbold$? echo$price?/spanbr ?if ($type==) {}? ?if ($type==BUS) {echo 'Business Opportunities';}? ?if ($type==COM) {echo 'Commercial';}? ?if ($type==CON) {echo 'Condo/Townhouse';}? ?if ($type==DUP) {echo 'Duplex';}? ?if ($type==FAR) {echo 'Farms amp; Ranches';}? ?if ($type==INC) {echo 'Income Properties';}? ?if ($type==LAK) {echo 'Lake Properties/Waterfront';}? ?if ($type==MOB) {echo 'Mobile Home';}? ?if ($type==RES) {echo 'Residential';}? ?if ($type==TIM) {echo 'Time Share';}? ?if ($type==VAC) {echo 'Vacant Land';}? br ? echo$bedrooms? BR / ? echo$bathrooms? BAbr ? echo$city?, ? echo$state?/td /tr /table ?} $total_results = mysql_result(mysql_query($sql1),0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Build Page Number Hyperlinks echo centerSelect a Pagebr /; // Build Previous Link if($page 1){ $prev = ($page - 1); echo a href=\.$PHP_SELF.?page=$prev\Previous/anbsp;; } for($i = 1; $i = $total_pages; $i++){ if(($page) == $i){ echo $inbsp;; } else { echo a href=\.$PHP_SELF.?page=$i\$i/anbsp;; } } // Build Next Link if($page $total_pages){ $next = ($page + 1); echo a href=\.$PHP_SELF.?page=$next\Next/a; } echo /center; include($config[template_path]/user_bottom.html); ? -- Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with code
I am having a problem with the code below it provides the first page with out any problem but when I select the next page it shows all the results from the first page and the results from the second page. It does the same thing on the third page also. I have been looking at it for two days and can not fined the error in the code ?php include(include/common.php); include($config[template_path]/user_top.html); // If current page number, use it // if not, set one! if(!isset($page)){ $page = 1; } else { $page = $page; } // Define the number of results per page $max_results = $config['listings_per_page']; // Figure out the limit for the query based // on the current page number. $from = (($page * $max_results) - $max_results); //Process all the search results to create the sql if($searchRule == or){ $cond = OR; } else $cond = and; //the main sql statment $sql = 'SELECT * FROM listing '; //the sql statment required to set the total number of pages $sql1 = 'SELECT COUNT(*) as Num FROM listing '; if($state != || $type != || $county != || $price != ){ $sql .= WHERE ; $sql1 .= WHERE ; if($state != ){ $sql .= state = '. $state .'; $sql1 .= state = '. $state .'; if($state != || $type != || $county != || $price != ){ $sql .= $cond ; $sql1 .= $cond ; } } if($type != ){ $sql .= type = '. $type .'; $sql1 .= type = '. $type .'; if($state != || $type != || $county != || $price != ) { $sql .= $cond ; $sql1 .= $cond ; } } if($county != ){ $sql .= county = '. $county .'; $sql1 .= county = '. $county .'; if($state != || $type != || $county != || $price != ){ $sql .= $cond ; $sql1 .= $cond ; } } if($Pricerange != ){ if($Pricerange==range1){ $Price1=0; $Price2=10; $simbale==; $sql .= price = '. $Price2.'; $sql1 .= price = '. $Price2.'; } if($Pricerange==range2){ $Price1=10; $Price2=15; $sql .= (price '. $Price1.' OR price = '. $Price2.'); $sql1 .= (price '. $Price1.' OR price = '. $Price2.'); } if($Pricerange==range3){ $Price1=15; $Price2=20; $sql .= (price '. $Price1.' OR price = '. $Price2.'); $sql1 .= (price '. $Price1.' OR price = '. $Price2.'); } if($Pricerange==range4) {$Price1=20; $Price2=25; $sql .= (price '. $Price1.' OR price = '. $Price2.'); $sql1 .= (price '. $Price1.' OR price = '. $Price2.'); } if($Pricerange==range5) {$Price1=25; $Price2=30; $sql .= (price '. $Price1.' OR price = '. $Price2.'); $sql1 .= (price '. $Price1.' OR price = '. $Price2.'); } if($Pricerange==range6) {$Price1=30; $Price2=; $sql .= price = '. $Price1.'; $sql1 .= price = '. $Price1.'; }} $sql .= LIMIT . $from . , . $max_results; } $result=safe_query($sql); while ($row = mysql_fetch_array($result)){ extract($row); ? div align=center table border=0 width=631 height=1 cellpadding=0 cellspacing=0 tr td width=81 height=1 bgcolor=#60A0F8font color=#FFspan class=contentsmallListing/spanspan class=contentbold #? echo$listingId?/span/fontimg hspace=0 src=images/user_photos/thumb_5000_1.jpg border=0 width=83 height=50br /td center td width=401 height=1textarea cols=45 rows=6? echo$descr1?/textarea br a href=more_results.php?listingId=? echo$listingId?searchlistingid=yes more info.../a/td td width=127 height=1span class=contentbold$? echo$price?/spanbr ?if ($type==) {}? ?if ($type==BUS) {echo 'Business Opportunities';}? ?if ($type==COM) {echo 'Commercial';}? ?if ($type==CON) {echo 'Condo/Townhouse';}? ?if ($type==DUP) {echo 'Duplex';}? ?if ($type==FAR) {echo 'Farms amp; Ranches';}? ?if ($type==INC) {echo 'Income Properties';}? ?if ($type==LAK) {echo 'Lake Properties/Waterfront';}? ?if ($type==MOB) {echo 'Mobile Home';}? ?if ($type==RES) {echo 'Residential';}? ?if ($type==TIM) {echo 'Time Share';}? ?if ($type==VAC) {echo 'Vacant Land';}? br ? echo$bedrooms? BR / ? echo$bathrooms? BAbr ? echo$city?, ? echo$state?/td /tr /table ?} $total_results = mysql_result(mysql_query($sql1),0); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($total_results / $max_results); // Build Page Number Hyperlinks echo centerSelect a Pagebr /; // Build Previous Link if($page 1){ $prev = ($page - 1); echo a href=\.$PHP_SELF.?page=$prev\Previous/anbsp;; } for($i = 1; $i = $total_pages; $i++){ if(($page) == $i){ echo $inbsp;; } else { echo a href=\.$PHP_SELF.?page=$i\$i/anbsp;; } } // Build Next Link if($page $total_pages){ $next = ($page + 1); echo a href=\.$PHP_SELF.?page=$next\Next/a; } echo /center; include($config[template_path]/user_bottom.html); ? -- Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem Understanding Code in 2nd edition Welling/Thomson PHP?MySQL Web Development Book
Sorry for the long post--and the cross-posting to a MySQL list, for those of you seeing this a second time--but I'm using with difficulty the 2nd edition of Welling/Thomson's PHP and MySQL Web Development as a textbook for self-teaching (and I'm at the end of my rope). After being pleased to work my way thru to Chapter 14, not memorizing the earlier material, but having some success basically understanding it--I get to the first meaty topic that I was really looking forward to getting into: the business of authentication. So I went into MySQL and created the database auth and the table auth, using the following script: create database auth; use auth; create table auth ( namevarchar(10) not null, passvarchar(30) not null, primary key (name) ); insert into auth values ('user', 'pass'); insert into auth values ( 'testuser', password('test123') ); grant select, insert, update, delete on auth.* to [EMAIL PROTECTED] identified by 'rivet'; I used my username that I log into the computer I'm working on--an offline Powerbook--at the bottom, 'stevet', as well as the password that belongs to that username, 'rivet'. Since I'm using the test server 'localhost' on the Powerbook, I used that in the code, as well. These have worked when called for in previous PHP/MySQL exercises, so it's not something new I invented just for this batch of tutorials. Next I opened listing 14.2, secretdb.php--placed properly at the root level for accessing in my test server--in my browser. Here's secretdb.php: ?php if(!isset($_POST['name'])!isset($_POST['password'])) { //Visitor needs to enter a name and password ? h1Please Log In/h1 This page is secret. form method=post action=secretdb.php table border=1 tr th Username /th td input type=text name=name /td /tr tr th Password /th td input type=password name=password /td /tr tr td colspan=2 align=center input type=submit value=Log In /td /tr /table /form ?php } else { // connect to mysql $mysql = mysql_connect( 'localhost', 'stevet', 'rivet' ); if(!$mysql) { echo 'Cannot connect to database.'; exit; } // select the appropriate database $mysql = mysql_select_db( 'auth' ); if(!$mysql) { echo 'Cannot select database.'; exit; } // query the database to see if there is a record which matches $query = select count(*) from auth where name = '$name' and pass = '$password'; $result = mysql_query( $query ); if(!$result) { echo 'Cannot run query.'; exit; } $count = mysql_result( $result, 0, 0 ); if ( $count 0 ) { // visitor's name and password combination are correct echo 'h1Here it is!/h1'; echo 'I bet you are glad you can see this secret page.'; } else { // visitor's name and password combination are not correct echo 'h1Go Away!/h1'; echo 'You are not authorized to view this resource.'; } } ? I was greeted by the Please Log In screen. I used 'user' as username and 'pass' as the password, as that was one of the two combinations the first bit of code above inserted into the table auth. After submitting, I got the customized error message: Go Away! You are not authorized to view this resource. Just to make certain, I substituted 'root' and my root password in both pieces of code for 'stevet' and 'rivet', and got the same error screen. I don't understand why either of those username/password combinations don't work. I mean, they're in the authorization table. And I'm obviously connecting to the database, as I'm getting past that stage of the code. Can anyone tell me what I'm too dense to see? Thanks very much. Steve Tiano -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem Understanding Code in 2nd edition Welling/Thomson PHP?MySQL Web Development Book
Hi, from what I see the problem is that you add the authentification passwords to the database via password('password') but then your script checks for entries in the database where username= username password = password which cannot work. You have to make it where username = username password = password('password') exactly: // query the database to see if there is a record which matches $query = select count(*) from auth where name = '$name' and pass = password('$password'); Regards, Hendrik Stephen Tiano wrote: Sorry for the long post--and the cross-posting to a MySQL list, for those of you seeing this a second time--but I'm using with difficulty the 2nd edition of Welling/Thomson's PHP and MySQL Web Development as a textbook for self-teaching (and I'm at the end of my rope). After being pleased to work my way thru to Chapter 14, not memorizing the earlier material, but having some success basically understanding it--I get to the first meaty topic that I was really looking forward to getting into: the business of authentication. So I went into MySQL and created the database auth and the table auth, using the following script: create database auth; use auth; create table auth ( namevarchar(10) not null, passvarchar(30) not null, primary key (name) ); insert into auth values ('user', 'pass'); insert into auth values ( 'testuser', password('test123') ); grant select, insert, update, delete on auth.* to [EMAIL PROTECTED] identified by 'rivet'; I used my username that I log into the computer I'm working on--an offline Powerbook--at the bottom, 'stevet', as well as the password that belongs to that username, 'rivet'. Since I'm using the test server 'localhost' on the Powerbook, I used that in the code, as well. These have worked when called for in previous PHP/MySQL exercises, so it's not something new I invented just for this batch of tutorials. Next I opened listing 14.2, secretdb.php--placed properly at the root level for accessing in my test server--in my browser. Here's secretdb.php: ?php if(!isset($_POST['name'])!isset($_POST['password'])) { //Visitor needs to enter a name and password ? h1Please Log In/h1 This page is secret. form method=post action=secretdb.php table border=1 tr th Username /th td input type=text name=name /td /tr tr th Password /th td input type=password name=password /td /tr tr td colspan=2 align=center input type=submit value=Log In /td /tr /table /form ?php } else { // connect to mysql $mysql = mysql_connect( 'localhost', 'stevet', 'rivet' ); if(!$mysql) { echo 'Cannot connect to database.'; exit; } // select the appropriate database $mysql = mysql_select_db( 'auth' ); if(!$mysql) { echo 'Cannot select database.'; exit; } // query the database to see if there is a record which matches $query = select count(*) from auth where name = '$name' and pass = '$password'; $result = mysql_query( $query ); if(!$result) { echo 'Cannot run query.'; exit; } $count = mysql_result( $result, 0, 0 ); if ( $count 0 ) { // visitor's name and password combination are correct echo 'h1Here it is!/h1'; echo 'I bet you are glad you can see this secret page.'; } else { // visitor's name and password combination are not correct echo 'h1Go Away!/h1'; echo 'You are not authorized to view this resource.'; } } ? I was greeted by the Please Log In screen. I used 'user' as username and 'pass' as the password, as that was one of the two combinations the first bit of code above inserted into the table auth. After submitting, I got the customized error message: Go Away! You are not authorized to view this resource. Just to make certain, I substituted 'root' and my root password in both pieces of code for 'stevet' and 'rivet', and got the same error screen. I don't understand why either of those username/password combinations don't work. I mean, they're in the authorization table. And I'm obviously connecting to the database, as I'm getting past that stage of the code. Can anyone tell me what I'm too dense to see? Thanks very much. Steve Tiano
Re: [PHP] Problem Understanding Code in 2nd edition Welling/Thomson PHP?MySQL Web Development Book
Hi, Sunday, November 9, 2003, 12:48:17 AM, you wrote: ST Sorry for the long post--and the cross-posting to a MySQL list, for ST those of you seeing this a second time--but I'm using with difficulty ST the 2nd edition of Welling/Thomson's PHP and MySQL Web Development as a ST textbook for self-teaching (and I'm at the end of my rope). ST After being pleased to work my way thru to Chapter 14, not memorizing ST the earlier material, but having some success basically understanding ST it--I get to the first meaty topic that I was really looking forward ST to getting into: the business of authentication. ST So I went into MySQL and created the database auth and the table auth, ST using the following script: ST create database auth; ST use auth; ST create table auth ( ST namevarchar(10) not null, ST passvarchar(30) not null, ST primary key (name) ST ); ST insert into auth values ST ('user', 'pass'); ST insert into auth values ST ( 'testuser', password('test123') ); ST grant select, insert, update, delete ST on auth.* ST to [EMAIL PROTECTED] ST identified by 'rivet'; ST I used my username that I log into the computer I'm working on--an ST offline Powerbook--at the bottom, 'stevet', as well as the password that ST belongs to that username, 'rivet'. Since I'm using the test server ST 'localhost' on the Powerbook, I used that in the code, as well. These ST have worked when called for in previous PHP/MySQL exercises, so it's not ST something new I invented just for this batch of tutorials. ST Next I opened listing 14.2, secretdb.php--placed properly at the root ST level for accessing in my test server--in my browser. Here's secretdb.php: ST ?php ST if(!isset($_POST['name'])!isset($_POST['password'])) ST { ST //Visitor needs to enter a name and password ? ST h1Please Log In/h1 ST This page is secret. ST form method=post action=secretdb.php ST table border=1 ST tr ST th Username /th ST td input type=text name=name /td ST /tr ST tr ST th Password /th ST td input type=password name=password /td ST /tr ST tr ST td colspan=2 align=center ST input type=submit value=Log In ST /td ST /tr ST /table ST /form ST ?php ST } ST else ST { ST // connect to mysql ST $mysql = mysql_connect( 'localhost', 'stevet', 'rivet' ); ST if(!$mysql) ST { ST echo 'Cannot connect to database.'; ST exit; ST } ST // select the appropriate database ST $mysql = mysql_select_db( 'auth' ); ST if(!$mysql) ST { ST echo 'Cannot select database.'; ST exit; ST } ST // query the database to see if there is a record which matches ST $query = select count(*) from auth where ST name = '$name' and ST pass = '$password'; ST $result = mysql_query( $query ); ST if(!$result) ST { ST echo 'Cannot run query.'; ST exit; ST } ST $count = mysql_result( $result, 0, 0 ); ST if ( $count 0 ) ST { ST // visitor's name and password combination are correct ST echo 'h1Here it is!/h1'; ST echo 'I bet you are glad you can see this secret page.'; ST } ST else ST { ST // visitor's name and password combination are not correct ST echo 'h1Go Away!/h1'; ST echo 'You are not authorized to view this resource.'; ST } ST } ? ST I was greeted by the Please Log In screen. I used 'user' as username and ST 'pass' as the password, as that was one of the two combinations the ST first bit of code above inserted into the table auth. After submitting, ST I got the customized error message: Go Away! You are not authorized to ST view this resource. ST Just to make certain, I substituted 'root' and my root password in both ST pieces of code for 'stevet' and 'rivet', and got the same error screen. ST I don't understand why either of those username/password combinations ST don't work. I mean, they're in the authorization table. And I'm ST obviously connecting to the database, as I'm getting past that stage of ST the code. Can anyone tell me what I'm too dense to see? ST Thanks very much. ST Steve Tiano looks like you need to use $_POST['name'] and $_POST['pass'] in the query or assign those values to $name and $pass first. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with code (almost fixed)
Hi, I fixed my code to handle forms using $_REQUEST. Just having problem with the fields with multiple contents... the one you have to call like field[0], field[1],etc... How do I use the brackets inside brackets? my case is this: Thanks. I have fixed everything with $_REQUEST but I am having problem with the multiple fields, like this: $message .= (hotel = . $_REQUEST['pac_hot[0]'] . - . $_REQUEST['pac_hot[1]']. - .$_REQUEST['pac_hot[2]'] . - .$_REQUEST['pac_hot[3]'] . \n); How am I going to use the brackets inside the brackets? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] problem with code (almost fixed)
You'd write something like: $_REQUEST['pac_hot'][0], $_REQUEST['pac_hot'][1] and so on. Noor -Original Message- From: Yan Grossman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, November 19, 2002 12:07 PM To: [EMAIL PROTECTED] Subject: [PHP] problem with code (almost fixed) Hi, I fixed my code to handle forms using $_REQUEST. Just having problem with the fields with multiple contents... the one you have to call like field[0], field[1],etc... How do I use the brackets inside brackets? my case is this: Thanks. I have fixed everything with $_REQUEST but I am having problem with the multiple fields, like this: $message .= (hotel = . $_REQUEST['pac_hot[0]'] . - . $_REQUEST['pac_hot[1]']. - .$_REQUEST['pac_hot[2]'] . - .$_REQUEST['pac_hot[3]'] . \n); How am I going to use the brackets inside the brackets? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with Code
Hi, I have a couple of questions before I get to my problem. 1. Is there any documentation that explains the differences between the versions of PHP? 2. Does it matter when writing php code that you specifiy the file name in the following manner? test.php3 test.php4 or whatever. I'm assumming this is version specific. My Problem: I have the following code: # more headlines* ?php include include_fns.php3; include header.php3; $conn = db_connect(); $pages_sql = select * from pages order by code; $pages_result = mysql_query($pages_sql, $conn); while ($pages = mysql_fetch_array($pages_result)) { $story_sql = select * from stories where page = '$pages[code]' and published is not null order by published desc; $story_result = mysql_query($story_sql, $conn); if (mysql_num_rows($story_result)) { $story = mysql_fetch_array($story_result); print TABLE BORDER=0 WIDTH=400; print TR; print TD ROWSPAN=2 WIDTH=100; if ($story[picture]) print IMG SRC=\resize_image.php?image=$story[picture]\; print /TD; print TD; print H3$pages[description]/H3; print $story[headline]; print /TD; print /TR; print TRTD ALIGN=RIGHT; print A HREF=\page.php3?page=$pages[code]\; print FONT SIZE=1Read more $pages[code] .../FONT; print /A; print /TABLE; } } include footer.php3; ? # I have the following error: Fatal error: Call to unsupported or undefined function include_once() in include_fns.php3 on line 7 It seems to me that include_once is a legal function but I can't the orgination of this funtion other than that stupid include_fns.php3 file? Any ideas on this. Configuration: OS: Solaris 2.8 10/00 on Intel Hardware. Apache: 1.3.9 PHP: 3.0.15 mysql: 3.23.46 My ISP is running: OS: Irix 6.4 Apache: 1.3.9 PHP: 3.0.9 mysql: 3.22.23b I do appreciate any help on this. -- *** Phillip B. Bruce *** *** http://pbbruce.home.mindspring.com *** *** [EMAIL PROTECTED] *** *** *** *** Have you ever noticed? Anybody going slower than*** *** you is an idiot, and anyone going faster than you*** *** is a maniac. - George Carlin*** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problem with Code
1. http://www.php.net/ChangeLog-4.php 2. and yes, you have to specify the exact filename...your issue is that include_once is not a function in php3, if that code is infact from a php3 file... Phillip B. Bruce wrote: Hi, I have a couple of questions before I get to my problem. 1. Is there any documentation that explains the differences between the versions of PHP? 2. Does it matter when writing php code that you specifiy the file name in the following manner? test.php3 test.php4 or whatever. I'm assumming this is version specific. My Problem: I have the following code: # more headlines* ?php include include_fns.php3; include header.php3; $conn = db_connect(); $pages_sql = select * from pages order by code; $pages_result = mysql_query($pages_sql, $conn); while ($pages = mysql_fetch_array($pages_result)) { $story_sql = select * from stories where page = '$pages[code]' and published is not null order by published desc; $story_result = mysql_query($story_sql, $conn); if (mysql_num_rows($story_result)) { $story = mysql_fetch_array($story_result); print TABLE BORDER=0 WIDTH=400; print TR; print TD ROWSPAN=2 WIDTH=100; if ($story[picture]) print IMG SRC=\resize_image.php?image=$story[picture]\; print /TD; print TD; print H3$pages[description]/H3; print $story[headline]; print /TD; print /TR; print TRTD ALIGN=RIGHT; print A HREF=\page.php3?page=$pages[code]\; print FONT SIZE=1Read more $pages[code] .../FONT; print /A; print /TABLE; } } include footer.php3; ? # I have the following error: Fatal error: Call to unsupported or undefined function include_once() in include_fns.php3 on line 7 It seems to me that include_once is a legal function but I can't the orgination of this funtion other than that stupid include_fns.php3 file? Any ideas on this. Configuration: OS: Solaris 2.8 10/00 on Intel Hardware. Apache: 1.3.9 PHP: 3.0.15 mysql: 3.23.46 My ISP is running: OS: Irix 6.4 Apache: 1.3.9 PHP: 3.0.9 mysql: 3.22.23b I do appreciate any help on this. -- *** Phillip B. Bruce *** *** http://pbbruce.home.mindspring.com *** *** [EMAIL PROTECTED] *** *** *** *** Have you ever noticed? Anybody going slower than*** *** you is an idiot, and anyone going faster than you*** *** is a maniac. - George Carlin*** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problem with Code
Hi, I have a couple of questions before I get to my problem. 1. Is there any documentation that explains the differences between the versions of PHP? sure. have a look at the changelog http://www.php.net/ChangeLog-4.php 2. Does it matter when writing php code that you specifiy the file name in the following manner? test.php3 test.php4 or whatever. I'm assumming this is version specific. My Problem: I have the following code: [] I have the following error: Fatal error: Call to unsupported or undefined function include_once() in include_fns.php3 on line 7 It seems to me that include_once is a legal function but I can't the orgination of this funtion other than that stupid include_fns.php3 file? Any ideas on this. Configuration: OS: Solaris 2.8 10/00 on Intel Hardware. Apache: 1.3.9 PHP: 3.0.15 mysql: 3.23.46 My ISP is running: OS: Irix 6.4 Apache: 1.3.9 PHP: 3.0.9 mysql: 3.22.23b I do appreciate any help on this. include_once() was added in PHP 4.0.1pl2 best regards attila strauss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Weird PHP problem...Example code...
Ok, this code is used on the index page of on of my sites. It prints out a list of links from a database. I am using PHP sessions. When I open a new browser and go the site for the first time the HTML that is output by my code is not correct. This is only on SOME of the lines, but it is always on the SAME lines. After a reload or even going to another web site and back it works fine every time. I noticed that PHP is automatically adding a PHPSESSID to the links. I think this is causing the problem. PHP seems to be adding more than just that. Anyone seen this before? Anyone know how I can fix it? Thanks in advance for any help! WEIRD HTML START (first view of page in new browser window) a href='/viewstory.php?story=20PHPSESSID=61bf547309e9bce7c1e333fb1958cd89' target='_self'tr Test 1.../abr a href='/viewstory.php?story=28PHPSESSID=61bf547309e9bce7c1e333fb1958cd89' target='_self'tr Test 2.../abr a href='/viewstory.php?story=21PHPSESSID=61bf547309e9bce7c1e333fb1958cd89' target='_self'tr Test 3.../abr a href='/viewstory.php?story=27PHPSESSID=61bf547309e9bce7c1e333fb1958cd89' target='_self'tr Test 4.../abr WEIRD HTML END CORRECT HTML START (after the first page view I get this) a href='/viewstory.php?story=20' target='_self'Test 1.../abr a href='/viewstory.php?story=28' target='_self'Test 2.../abr a href='/viewstory.php?story=21' target='_self'Test 3.../abr a href='/viewstory.php?story=27' target='_self'Test 4.../abr CORRECT HTML END PHP CODE START while($row = mysql_fetch_assoc($result)) { echo a href='/viewstory.php?story=; echo $row[RECORD_ID]; echo ' target='_self'; if (strlen($row[HEADLINE]) 20) { echo substr($row[HEADLINE], 0, 20); echo '...'; } else { echo $row[HEADLINE]; } } echo '/a'; echo 'br'; } PHP CODE END -- Dana Holt / [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Weird PHP problem...Example code...
Yes, I see this problem before, There was a setting that you turn on/off in the php.ini file..forgot which one.. maybe these: ; use transient sid support if enabled by compiling with --enable-trans-sid. session.use_trans_sid = 1 url_rewriter.tags = a=href,area=href,frame=src,input=src,form=fakeentry anyway, as a work around, you can have a redirector to this page, or this page can redirect to itself (to simulate reload) ? // very start of page if (!isset($reload)) { Header(Location: $PHP_SELF?reload=y); exit(); } // continue script here... ? Dana Holt [EMAIL PROTECTED] wrote in message 01c13a93$edf933e0$6400a8c0@MORPHEUS">news:01c13a93$edf933e0$6400a8c0@MORPHEUS... Ok, this code is used on the index page of on of my sites. It prints out a list of links from a database. I am using PHP sessions. When I open a new browser and go the site for the first time the HTML that is output by my code is not correct. This is only on SOME of the lines, but it is always on the SAME lines. After a reload or even going to another web site and back it works fine every time. I noticed that PHP is automatically adding a PHPSESSID to the links. I think this is causing the problem. PHP seems to be adding more than just that. Anyone seen this before? Anyone know how I can fix it? Thanks in advance for any help! WEIRD HTML START (first view of page in new browser window) a href='/viewstory.php?story=20PHPSESSID=61bf547309e9bce7c1e333fb1958cd89' target='_self'tr Test 1.../abr a href='/viewstory.php?story=28PHPSESSID=61bf547309e9bce7c1e333fb1958cd89' target='_self'tr Test 2.../abr a href='/viewstory.php?story=21PHPSESSID=61bf547309e9bce7c1e333fb1958cd89' target='_self'tr Test 3.../abr a href='/viewstory.php?story=27PHPSESSID=61bf547309e9bce7c1e333fb1958cd89' target='_self'tr Test 4.../abr WEIRD HTML END CORRECT HTML START (after the first page view I get this) a href='/viewstory.php?story=20' target='_self'Test 1.../abr a href='/viewstory.php?story=28' target='_self'Test 2.../abr a href='/viewstory.php?story=21' target='_self'Test 3.../abr a href='/viewstory.php?story=27' target='_self'Test 4.../abr CORRECT HTML END PHP CODE START while($row = mysql_fetch_assoc($result)) { echo a href='/viewstory.php?story=; echo $row[RECORD_ID]; echo ' target='_self'; if (strlen($row[HEADLINE]) 20) { echo substr($row[HEADLINE], 0, 20); echo '...'; } else { echo $row[HEADLINE]; } } echo '/a'; echo 'br'; } PHP CODE END -- Dana Holt / [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]