Dynadot โ€” .com Registration $8.99

What is wrong in this

Spacemail by SpaceshipSpacemail by Spaceship
Watch
Impact
91
Code:
<?php
$EmailFrom = " Sites Subscription";
$EmailTo = "[email protected]";
$Subject = "New User Submission";
$E-mail = Trim(stripslashes($_POST['E-mail'])); 

$validationOK=true;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

$Body = "";
$Body .= "E-mail: ";
$Body .= $E-mail;
$Body .= "\n";

// send email 
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");

// redirect to success page 
if ($success){
echo "thank you for submission. You will receive new proxies almost every day. To unsubscribe please send me a mail directly at the email listed at the top of the main site";
} else { 
echo "Unknown Failure. Please send me a mail directly at the email listed at the top of the main site";
}

?>

please tell me what is wrong in this above code. this is sending no output.. nor does it display anything.. just a blank page :(

thanks
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
A few minor errors... Fixed it up, added a verification (BASIC)...

PHP:
<?php
$EmailFrom = " Sites Subscription";
$EmailTo = "[email protected]";
$Subject = "New User Submission";
$E_mail = Trim(stripslashes($_POST['email'])); 

$validationOK=true;
if (!$validationOK) {
  print "<meta http_equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

$Body = "";
$Body .= "E_mail: ";
$Body .= $E_mail;
$Body .= "\n";

// send email 
if (isset($_POST['email'])) {
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
}
// redirect to success page 
if ($success){
echo "thank you for submission. You will receive new proxies almost every day. To unsubscribe please send me a mail directly at the email listed at the top of the main site";
} else { 
echo "Error... Try again... <form action=\"" . $_SERVER["SCRIPT_NAME"] ."\" method=\"POST\"><br /><br />Email: <input type=\"text\" name=\"email\" /><input type=\"submit\" value=\"Submit\"";
}

?>
 
0
•••
That's a very insecure script don't use it or it will become a spambot haven. You need to clean all input into mail.
 
0
•••
Yep. Your first problem was that you had a dash in a variable name. There SHOULD have been output: always use error_reporting( E_ALL ); when nothing happens.
 
0
•••
He didn't ask for security. :td: But yes, you had a dash in a variable name.
 
0
•••
labrocca said:
That's a very insecure script don't use it or it will become a spambot haven. You need to clean all input into mail.
Dan i have decided to trash that script which ppl were calling insecure becasue i am not one of the best programmers around and better to have problems initially rather than afterwards

i am using ur script now http://mm5.info/contact.php :)
 
0
•••
Particularly with mail scripts, you NEED to be careful about what you create. I made a mail spoofer on my website, and months later in ****ing around with Cpanel settings, accidentally took off the password protection on the directory it was sitting in. Within hours, in this obscure directory of a website I use mainly for storage, spammers found it and sent off somewhere on the order of tens of thousands of emails. If I didn't know my webhost on a personal level, he would have sued my ass to oblivion for the mess it caused getting his servers on anti-spam lists.
 
0
•••
Unstoppable Domains
Domain Recover
DomainEasy โ€” Live Options
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back