What is wrong in this

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
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
Close
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
Close
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
Close
He didn't ask for security. :td: But yes, you had a dash in a variable name.
 
0
Close
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
Close
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
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back