dupreelove Posted July 23, 2009 Share Posted July 23, 2009 Hi I have a huge problem with this mail form - it uploads the files perfectly to my server and sends me a notification on my mail, but it doesn't send the information written in the text-boxes - in my mail they are left blank. I've modified the form to only include the following boxes "Name", "Email" og "Info" - does this mean that the php-script, further down, has to be rewritten? I thought so, so I tried to delete "Phone", "Fax", "Speciality" og "Clinic" all the places they appeard in the script, but that didn't help? - I seriously hope some of you guys can help - I'm torn apart by this stupid script PHP: <? $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'] > 0 && $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 = ""; $myfrom = $Email; $myemail = "xxx@xxx.dk"; $todayis = date("l, F j, Y, g:i a") ; $filename="http://www.xxx.dk/".$pathext.$HTTP_POST_FILES['uploadedfile']['name'].$Off Ext; $filename=str_replace("","%20",$filename); $Email= stripcslashes($Email); $Name= stripcslashes($Name); $Phone= stripcslashes($Phone); $info= stripcslashes($info); $Fax= stripcslashes($Fax); $Speciality= stripcslashes($Speciality); $Clinic= stripcslashes($Clinic); $subject= "Request From Website"; $message = " uploadedfile : $filename Name : $Name Email : $Email Phone : $Phone Fax : $Fax Speciality : $Speciality Clinic/Hospital :$Clinic Comments/Request :$info "; $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."; } } print $msg; // Your message has been sent successfully with attachment. ?> Quote Link to comment Share on other sites More sharing options...
Kieran Menor Posted July 23, 2009 Share Posted July 23, 2009 First off, you need to stop using $HTTP_xxxxx. These have been obsoleted by $_GET, $_POST, $_REQUEST, $_COOKIE, $_FILES, and so on. I would guess that your form fields turn out blank because the server does not have register_globals enabled. Say you have a form field something like this: <input type="text" name="email">, you would read it in PHP using $_POST['email']. Quote Link to comment Share on other sites More sharing options...
mike12255 Posted July 23, 2009 Share Posted July 23, 2009 <?php $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'] > 0 && $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 = ""; $myfrom = $Email; $myemail = "xxx@xxx.dk"; $todayis = date("l, F j, Y, g:i a") ; $filename="http://www.xxx.dk/".$pathext.$HTTP_POST_FILES['uploadedfile']['name'].$Off Ext; $filename=str_replace("","%20",$filename); $Email= stripcslashes($Email); $Name= stripcslashes($Name); $Phone= stripcslashes($Phone); $info= stripcslashes($info); $Fax= stripcslashes($Fax); $Speciality= stripcslashes($Speciality); $Clinic= stripcslashes($Clinic); $subject= "Request From Website"; $message = " uploadedfile : $filename Name : $Name Email : $Email Phone : $Phone Fax : $Fax Speciality : $Speciality Clinic/Hospital :$Clinic Comments/Request :$info "; $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."; } } print $msg; // Your message has been sent successfully with attachment. ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.