Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Closed Thread
is this a php4 to php5 error?
Old 12-17-2010, 10:05 PM is this a php4 to php5 error?
Junior Talker

Posts: 2
Trades: 0
Hi,
This is my first email form which submits attachments and its starting to get quite frustrating.
I am very new to PHP as well, so forgive any glaring mistakes.

I've got it to work on one web service running php 4.4.9. But of course I need it on a php 5.2.14.

I can only deduce that it must be the change to the versions. Everything is the same except that.

Under the same conditions on the php5 server with IE I get http 500 internal server error and under Firefox I get;

<!-- SHTML Wrapper - 500 Server Error -->
[an error occurred while processing this directive]

My form points to the php which is there.

Any help would be appreciated
Thanks



Here is the code
PHP Code:
<?
$Name     
=$_REQUEST['Name'];
  
$Email  =$_REQUEST['Email'];
  
$Phone      =$_REQUEST['Phone'];
  
$City      =$_REQUEST['City'];
  
$Company    =$_REQUEST['Company'];
  
$Quantity     =$_REQUEST['Quantity'];
  
$description  =$_REQUEST['description'];
  
$Memory   =$_REQUEST['Memory'];
  
$MaxFileSize "2048000"// max file size in bytes
$HDDSpace "1048576"// max total size of all files in directory
$HDDTotal "445";
$OffExt "";
// add characters to strip out of filenames
$ThisFileName basename(__FILE__); // get the file name
$abspath str_replace($ThisFileName,"",__FILE__);   // get the directory path
// full path
$path=$abspath;
$pathext="upload/";
$snr = array("%","'","+","\\","/","#","..","!",'"',',','?','*','~');
$temp=$HTTP_POST_FILES['uploadedfile']['name'];

if(
$HTTP_POST_FILES['uploadedfile']['name'])
{
            
$HTTP_POST_FILES['uploadedfile']['name'] = strip_tags($HTTP_POST_FILES['uploadedfile']['name']);
            
$HTTP_POST_FILES['uploadedfile']['name'] = str_replace($snr,"",$HTTP_POST_FILES['uploadedfile']['name']);  // remove any % signs from the file name
            
$HTTP_POST_FILES['uploadedfile']['name'] = trim($HTTP_POST_FILES['uploadedfile']['name']);
            
/* if the file size is within allowed limits */
            
if($HTTP_POST_FILES['uploadedfile']['size'] > && $HTTP_POST_FILES['uploadedfile']['size'] < $MaxFileSize
   {
                
/* if adding the file will not exceed the maximum allowed total */
                
if(($HDDTotal $HTTP_POST_FILES['uploadedfile']['size']) < $HDDSpace
    {
                        
/* put the file in the directory */
move_uploaded_file($HTTP_POST_FILES['uploadedfile']['tmp_name'], $path.$pathext.$HTTP_POST_FILES['uploadedfile']['name'].$OffExt);       
      
$msg "The file ".$HTTP_POST_FILES['uploadedfile']['name']." is Successfully uploaded ";
     
$myfrom $Email
     
$myemail "lhadley91@hotmail.com"
     
$todayis date("l, F j, Y, g:i a") ;
     
     
$filename="http://usbframes.com/".$pathext.$HTTP_POST_FILES['uploadedfile']['name'].$OffExt;
     
$filename=str_replace("","%20",$filename);
     
$emailstripcslashes($email);
     
$namestripcslashes($name);
     
$phonestripcslashes($phone);
     
$descriptionstripcslashes($description);
     
$Citystripcslashes($City);
     
$Companystripcslashes($Company);
     
$Quantitystripcslashes($Quantity);
     
     
$subject"Request From Website";
     
     
$message 
     uploadedfile    : 
$filename
     Name            : 
$Name
     Email           : 
$Email
     Phone           : 
$Phone
     City             : 
$City
     Company       : 
$Company
     Quantity      : 
$Quantity
     Description    : 
$description
     Memory    : 
$Memory
     "
;
     
$from "From: $myfrom\r\n";
     
mail($myemail$subject$message$from);
                 }
                else 
    {
                        
$msg "The Filename: ".$HTTP_POST_FILES['uploadedfile']['name']." is BLOCKED from being uploaded here.";
                }                
              
  }
        else 
  {
        
$MaxKB $MaxFileSize/1024// show the max file size in Kb
        
$msg =  "The file was greater than the maximum allowed, file size of $MaxKB and could not be uploaded.";
     } 
 }  
header('Location:http://www.usbframes.com/thankyou.html');
?>
digitalboy91 is offline
View Public Profile
 
 
Register now for full access!
Old 12-17-2010, 10:31 PM Re: is this a php4 to php5 error?
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
HTTP_POST_FILES has been deprecated since PHP4.1.

http://php.net/manual/en/reserved.variables.files.php
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
View Public Profile Visit NullPointer's homepage!
 
Old 12-17-2010, 11:12 PM Re: is this a php4 to php5 error?
Junior Talker

Posts: 2
Trades: 0
Sigh, that did it.

Changed all HTTP_POST_FILES to $_FILES


Thanks a lot Nullpointer!
digitalboy91 is offline
View Public Profile
 
Closed Thread     « Reply to is this a php4 to php5 error?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13374 seconds with 12 queries