[PHP] Error checking on file upload
I've been working on a script for uploading a file to a Unix server. I'm testing the script and have it coded for error messages using a switch statement. One error that I am getting is case 2 "The file is bigger than this form allows" and I am wondering what might cause me to get the error for case 1 "The file is bigger than this PHP installation allows". Thank you, Althea Send this file: - $uploaddir = '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/'; $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); echo ''; if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; switch ($_FILES['userfile'] ['error']) { case 1: print ' The file is bigger than this PHP installation allows'; break; case 2: print ' The file is bigger than this form allows'; break; case 3: print ' Only part of the file was uploaded'; break; case 4: print ' No file was uploaded'; break; } } echo 'Here is some more debugging info:'; print_r($_FILES); echo "";
Re: [PHP] Error checking on file upload
Steve, Thanks a bunch. Must have been "dead brain" today. I knew that as well as could look it up using phpinfo(). Althea >>In your php.ini there are settings for "upload_max_filesize" and also "post_max_size." These would be causes for case 2. More information: http://us3.php.net/features.file-upload On 8/19/05, Peppy < [EMAIL PROTECTED]> wrote: > > I've been working on a script for uploading a file to a Unix server. I'm > testing the script and have it coded for error messages using a switch > statement. One error that I am getting is case 2 "The file is bigger than > this form allows" and I am wondering what might cause me to get the error > for case 1 "The file is bigger than this PHP installation allows". > > Thank you, > Althea > > > > > > > > Send this file: > > > > > - > $uploaddir = > '/home/httpd/vhosts/foxedge.net/httpdocs/lvs/phpclass/uploads/'; > $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); > > echo ''; > if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) { > echo "File is valid, and was successfully uploaded.\n"; > } else { > echo "Possible file upload attack!\n"; > switch ($_FILES['userfile'] ['error']) > { case 1: > print ' The file is bigger than this PHP installation allows'; > break; > case 2: > print ' The file is bigger than this form allows'; > break; > case 3: > print ' Only part of the file was uploaded'; > break; > case 4: > print ' No file was uploaded'; > break; > > } > } > > echo 'Here is some more debugging info:'; > print_r($_FILES); > > echo ""; > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] incrementing in a for loop
I've searched online and am unable to find how to increment by more than one in a for loop. for ($i = 1; $i <= 6; $i++) { Is it possible to increment $i by 5? Thanks.
[PHP] mail function-new line-security
I have been working on making my contact forms more secure. In my research, the occurence of the new line character \n at the end of the $headers variable in the mail function seems to be a security risk and opens one up to injection of spam email. This part I understand. I have been unable to find out this same information about the message variable. If I have a variable defining the message like this, can I use the new line character or am I opening myself up to more spam injection. $usermailmsg = "This is the information you submitted.\n If this is not correct, please contact us at mailto:$my_email.\n\n Name: $name\n Phone: $phone\n ... Please feel free to write us with any comments or suggestions so that we may better serve you.\n mailto:$my_email\n\n";; mail("$user_mail", "$subject", "$usermailmsg", "$headers"); Thanks in advance for any help.
Re: [PHP] mail function-new line-security
AJ, So what your reply means is that I should not have a new line character in any variable on my page??? Then is there any way to format the email so it is readable? Thanks.
Re: [PHP] script won't work on other server
Short tags are on on both servers. - Original Message - From: <[EMAIL PROTECTED]> To: "Peppy" <[EMAIL PROTECTED]> Sent: Wednesday, November 30, 2005 2:23 PM Subject: Re: [PHP] script won't work on other server > you're using the short-tag form: > > > rather than: > > > this may not be supported on both machines. > > haven't looked at other aspects of the script. > > > Original Message ---- > > Date: Wednesday, November 30, 2005 02:15:47 PM -0600 > > From: Peppy <[EMAIL PROTECTED]> > > To: php-general@lists.php.net > > Subject: [PHP] script won't work on other server > > > > I have a small script that I am testing out on two different > > servers. It uses the $_SERVER['HTTP_USER_AGENT'] to detect the > > browser and serve up a style sheet dependent on the results. > > (Please don't comment on its usefulness, it's just an example.) > > > > On one server, I can get this script to run correctly in all > > browsers that I test. On another server, it will not run correctly > > in Netscape (testing for the word Gecko, but have used Netscape > > also). Any help would be appreciated. > > > > Link to script: > > > > http://www.asrm.org/class/php/angelia.php > > > > In case it's needed, link to file with phpinfo(): > > > > http://www.asrm.org/test/test.php > > > > > > -- End Original Message -- > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] script won't work on other server
This info is for the server where the script does not work: Apache/1.3.33 (Unix) PHP/4.3.10 FreeBSD cliffb55.iserver.net 4.7-RELEASE-p28 FreeBSD 4.7-RELEASE-p28 #42: Tu i386 This info is for the server where the script works: Apache/2.0.40 (Red Hat Linux) PHP Version 4.3.2 Linux pl1.qcinet.net 2.4.20-8smp #1 SMP Thu Mar 13 17:45:54 EST 2003 i686 Thanks for your help. - Original Message - From: "Unknown Unknown" <[EMAIL PROTECTED]> To: "Peppy" <[EMAIL PROTECTED]> Cc: Sent: Thursday, December 01, 2005 4:08 PM Subject: Re: [PHP] script won't work on other server What are the server types like Apache IIS or something else? i am asking because the webserver might not give the PHP script all the data from the browser like browser name and stuff... On 11/30/05, Peppy <[EMAIL PROTECTED]> wrote: > > Short tags are on on both servers. > > - Original Message - > From: <[EMAIL PROTECTED]> > To: "Peppy" <[EMAIL PROTECTED]> > Sent: Wednesday, November 30, 2005 2:23 PM > Subject: Re: [PHP] script won't work on other server > > > > you're using the short-tag form: > > > >> > > rather than: > > > >> > > this may not be supported on both machines. > > > > haven't looked at other aspects of the script. > > > > > > Original Message > > > Date: Wednesday, November 30, 2005 02:15:47 PM -0600 > > > From: Peppy <[EMAIL PROTECTED]> > > > To: php-general@lists.php.net > > > Subject: [PHP] script won't work on other server > > > > > > I have a small script that I am testing out on two different > > > servers. It uses the $_SERVER['HTTP_USER_AGENT'] to detect the > > > browser and serve up a style sheet dependent on the results. > > > (Please don't comment on its usefulness, it's just an example.) > > > > > > On one server, I can get this script to run correctly in all > > > browsers that I test. On another server, it will not run correctly > > > in Netscape (testing for the word Gecko, but have used Netscape > > > also). Any help would be appreciated. > > > > > > Link to script: > > > > > > http://www.asrm.org/class/php/angelia.php > > > > > > In case it's needed, link to file with phpinfo(): > > > > > > http://www.asrm.org/test/test.php > > > > > > > > > > -- End Original Message -- > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Hi Everyone, I am running PHP 5 on Windosws XP SP2 with MySQL5, Bye Now!
Re: [PHP] Help Desk software
http://phptickets.org/ - Original Message - From: "Glenn Sieb" <[EMAIL PROTECTED]> To: Cc: "Daniel Lahey" <[EMAIL PROTECTED]> Sent: Tuesday, December 20, 2005 10:13 PM Subject: Re: [PHP] Help Desk software > Daniel Lahey said the following on 12/20/2005 10:28 PM: > > Can anyone recommend some good Open-Source Help Desk software for > > PHP? (I know this is a little off-topic, but I'm having a hard time > > finding decent Open Source software.) > IMHO the best is RT, which is Perl and Mason. > (http://www.bestpractical.com/rt) > > There are some nice PHP ones out there, but I don't have any experience > with them: > > ruQueue: http://freshmeat.net/projects/ruqueue/ > Hesk: http://www.phpjunkyard.com/free-helpdesk-software.php > Help Desk Software: http://www.helpdeskreloaded.com/ > > I'm sure there are more.. > > Best, > --Glenn > > -- > AIM: RainbearNJ YahooIM: rainbear_nj > > "They that can give up essential liberty to obtain a little temporary > safety deserve neither liberty nor safety." > ~Benjamin Franklin, Historical Review of Pennsylvania, 1759 > > -- > 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] Re: Solution [PHP] mail() and Return-Path header
Thanks Richard. That worked great. - Original Message - From: "Richard Heyes" <[EMAIL PROTECTED]> To: "Søren Schimkat" <[EMAIL PROTECTED]> Cc: Sent: Thursday, February 02, 2006 8:02 AM Subject: Re: [PHP] mail() and Return-Path header Søren Schimkat wrote: > Hi Guys > > I'm using the mail function for sending mail, and I would like to specify the > Return-Path header, but it would seem that PHP or Apache is modyfying the > header. > > This is the simple code: > > mail('[EMAIL PROTECTED]', 'Subject', 'Message', "From: > [EMAIL PROTECTED]: [EMAIL PROTECTED]"); > > .. but when the message bounces - it bounces to [EMAIL PROTECTED] instead of > the bounce adress? > > Any hints on how to solve this problem? If you're on *nix you can use the fifth parameter of the mail() function, and specify "[EMAIL PROTECTED]". -- Richard Heyes http://www.phpguru.org -- 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