[PHP] headers already sent.
(Know enough to be dangerous beginner...) Routine for a web login asked user name and password. User Name is entered correctly. Password is Incorrect. Next Try. User Name is enter correctly. Password is Entered Correctly. PHP notifies me on the html output that I am logged in. However, an error is appearing in text above the html output. It states Warning: Cannot modify header information - headers already sent by (output started at D:\webpages\\users.inc:11) in D:\webpages\\web\loginfunctions.php on line 26 Users.inc is == === Line 26 from the loginfunctions.php file is //now redirect the user to whatever page they wanted. header('Location: index.php?href='.$link); == I can anticipate what the problem is with the notification that PHP gives me with the headers already output. However, it says 'headers already sent by users.inc', huh? Suggestions of where to look on this bug is appreciated! -Pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] headers already sent.
At 10:30 PM 04/07/2006, you wrote: Comment inline: Thanks, I just found that out after, well I don't want to say how long it took . Is that just the way things are in PHP or is there a command / configuration to make something like this more obvious? Hmmm. maybe the IDE I'm using? Using EnginSite. Is there a better one for a Windows Environment ? ( head banging against wall ) -Pete P. Guethlein wrote: (Know enough to be dangerous beginner...) Routine for a web login asked user name and password. User Name is entered correctly. Password is Incorrect. Next Try. User Name is enter correctly. Password is Entered Correctly. PHP notifies me on the html output that I am logged in. However, an error is appearing in text above the html output. It states Warning: Cannot modify header information - headers already sent by (output started at D:\webpages\\users.inc:11) in D:\webpages\\web\loginfunctions.php on line 26 Users.inc is == This gap right here, it's outputting a carriage return and/or linefeed. headers get sent on the first character of output being sent. === Line 26 from the loginfunctions.php file is //now redirect the user to whatever page they wanted. header('Location: index.php?href='.$link); == I can anticipate what the problem is with the notification that PHP gives me with the headers already output. However, it says 'headers already sent by users.inc', huh? Suggestions of where to look on this bug is appreciated! -Pete -- 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] Beginner Help - Array
This seems like it should work, but the option statement is just filling in one line of datahm... the names have multiple territories (ID's), so I want to have one name associated with one territory ID ( other stuff happens elseware...). //building list of names and their territory matching ID's while($getidsd = mysql_fetch_array($getidsr)){ if ($getidsd['employeeid'] != '990'&& $getidsd['employeeid'] != '991') { $salespersonsstor= Array("name"=>$getidsd['fname'].' '.$getidsd['lname'],"idIS"=>$getidsd['employeeid']); } } asort($salespersonsstor); $salesmanactive=''; $salesmann=''; $ID1=''; foreach ($salespersonsstor as $key => $TheSalesManID) { switch ($key) { case "name": $salesmann = $TheSalesManID; break; case "idIS": $ID1 = $TheSalesManID; } If (($salesmann != '' && $ID1 != '') && ($salesmanactive != $salesmann)) { echo 'value="'.$ID1.'">'.$salesmann.''; $salesmanactive=$salesmann; $salesmann=''; $ID1=''; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Protecting index.php
Initial index.php file: = Hackers seem to be able to call a remote script by appending the URL to the href= command line . ( $include ) What buttons do I need to push to stop this? Does PHP have a setting to allow only local calls? or do I have to do it in the index.php file ? or ?? Advice welcome! -Pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Uploading Files
I'm at one of those frustration levels can't seem to get a script working that will post and upload a file to the server. I"m working with the below. Can you help? 0) print "Your file(s) has been uploaded."; echo ' Send this file: '; ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files - Beginner
I'm still very frustrated trying to figure out how to upload a file. I must have tried 15 different coding examples and none of them work. When I try and debug and do a print_r($_FILES); All I'm getting back is array() with no data. File upload is allowed in my php.ini Can anyone offer any other insight before my laptop sails into the wall ? Thanks, -Pete At 02:03 PM 05/21/2006, tedd wrote: At 1:52 AM -0700 5/21/06, P. Guethlein wrote: I'm at one of those frustration levels can't seem to get a script working that will post and upload a file to the server. I"m working with the below. Can you help? Guethlein: Yes, try this -- watch for line breaks. Also, create folders "uploads/tmp". The code works "as is" for me except that I have to give the "tmp" folder 0777 permissions* because the code runs as "nobody". I haven't figured out how to get around that, but I can change the uploaded file's permissions without error. (If anyone wants to show me OFF-LIST how to do this without setting the tmp folder to 0777, I'm all ears, but don't beat me up because I'm trying to learn.) Code follows: if (isset($_POST['submit'])) // handle the form -- start of main Submit conditional.. { // Create the file name. $filename = $_FILES['upload']['name']; $file_loaded = 0; // Move the file over. if (move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/tmp/$filename")) { echo 'The file has been uploaded to the server.'; chmod("uploads/tmp/$filename", 0755); echo ( '' . $filename . '' ); } else { echo ('ERROR: The file was not upload.'); } } else { ?> Select the file to upload: File: hth's tedd * Larry Ullman in his books says to use 0777 permission for uploading files. However, he does say that it is less secure and should be placed outside of the web directory. -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading Files - SOLVED
It worked perfectly! ES Simple Uploader Script located at http://www.hotscripts.com/PHP/Scripts_and_Programs/File_Manipulation/Upload_Systems/index.html If anyone else is on their learning curve... -Pete At 04:56 PM 05/21/2006, P. Guethlein wrote: I'm still very frustrated trying to figure out how to upload a file. I must have tried 15 different coding examples and none of them work. When I try and debug and do a print_r($_FILES); All I'm getting back is array() with no data. File upload is allowed in my php.ini Can anyone offer any other insight before my laptop sails into the wall ? Thanks, -Pete At 02:03 PM 05/21/2006, tedd wrote: At 1:52 AM -0700 5/21/06, P. Guethlein wrote: I'm at one of those frustration levels can't seem to get a script working that will post and upload a file to the server. I"m working with the below. Can you help? Guethlein: Yes, try this -- watch for line breaks. Also, create folders "uploads/tmp". The code works "as is" for me except that I have to give the "tmp" folder 0777 permissions* because the code runs as "nobody". I haven't figured out how to get around that, but I can change the uploaded file's permissions without error. (If anyone wants to show me OFF-LIST how to do this without setting the tmp folder to 0777, I'm all ears, but don't beat me up because I'm trying to learn.) Code follows: if (isset($_POST['submit'])) // handle the form -- start of main Submit conditional.. { // Create the file name. $filename = $_FILES['upload']['name']; $file_loaded = 0; // Move the file over. if (move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/tmp/$filename")) { echo 'The file has been uploaded to the server.'; chmod("uploads/tmp/$filename", 0755); echo ( '' . $filename . '' ); } else { echo ('ERROR: The file was not upload.'); } } else { ?> Select the file to upload: File: hth's tedd * Larry Ullman in his books says to use 0777 permission for uploading files. However, he does say that it is less secure and should be placed outside of the web directory. -- http://sperling.com http://ancientstones.com http://earthstones.com -- 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
RE: [PHP] Uploading Files - Beginner
Jay, Thanks for the response. I finally found a script that actually worked immediately. I posted the link in an earlier message. I found the authors directly link here http://www.energyscripts.com/Products/product2.html for others that may need help. -Pete At 05:23 PM 05/21/2006, you wrote: [snip] I'm still very frustrated trying to figure out how to upload a file. I must have tried 15 different coding examples and none of them work. When I try and debug and do a print_r($_FILES); All I'm getting back is array() with no data. File upload is allowed in my php.ini Can anyone offer any other insight before my laptop sails into the wall ? [/snip] Have you tried the very simple example shown in the manual? http://us3.php.net/manual/en/features.file-upload.php I will be right by my computer for a while, so make sure to reply to the list. Pay particular attention to MAX_FILE_SIZE. Even if file upload is allowed in you php.in are you running in safe mode? -- 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] Windows/Apache Shopping Cart Software
Anyone have any recommendations/Links to Shopping Cart Software that will run on Windows/Apache/PHP ? Thanks, -Pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php