im trying to use a token to secure my form on contact.php
<?
$token = md5(uniqid(rand(), true));
$_SESSION['token'] = $token;
$_SESSION['token_timestamp'] = time();
?>
with a hidden field
<input type="hidden" name="token" value="<? echo $token; ?>" />
and then on the sendmail , afters its passed validation using javascript
if ($_SESSION['token'] = $token) {
//Send the email. You can also have cc: and bcc: added, just add it after the from like this "From: $email\r\n", "cc: $email2\r\n"
$formsent = mail("$sendto","$subject",$message,"From: $wf_Email");
//If it was sent alright, echo confirmation
if ($formsent) {
echo "<fieldset id='resmsg'><legend id='restitle'>Thank you ".$wf_Name."</legend><p>We have recieved your information and will contact you shortly regarding you enquiry</p></fieldset>";
}else{ // It failed to send, so echo and error
echo "I'm sorry, there's a problem with your form. Please try again!.";
}
} else { echo "I'm sorry, there's a problem with your form. Please try again!."; }
my questions is, is that ok as i cant check wether it is working or not.