我一直在這裏待了幾個小時,對於問題是什麼而撓頭。驗證表單錯誤
表單工作併發送電子郵件,但是當驗證鏈接被點擊時,它不顯示回顯的「成功」消息,但死(「錯誤消息」);信息。任何與$鹽有關的事情?
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" size="35" name="email" title="Email">
<input id="button" type="submit" name="submit" value="Submit your Email" />
</form>
<?php
$salt = "mysecret";
if(isset($_POST["confirm"]) && isset($_POST["email"])){
$confirm = $_POST["confirm"];
$to_email = $_POST["email"];
if(sha1($salt.$to_email) == $confirm){
echo "Success";
} else{
die("error: mail not confirmed");
}
} elseif(isset($_POST["email"])){
$to_email = $_POST["email"];
$confirm_link = "http://www.mysite.com/form.php?confirm=".urlencode(sha1($salt.$to_email))."&mail=".urlencode($to_email);
$msg = "to confirm ... click the link: \n ".$confirm_link;
mail($to_email, "pls confirm your mail", $msg);
} else{
die("error message");
}
?>
http://www.tizag.com/phpT/postget.php – FirmView