grunshaw Posted August 9, 2009 Share Posted August 9, 2009 Hi guys. I've got the basic idea here, but i'm stuck on a bit of code to pull the verification key back to actually do something. Here is the code: <? extract($HTTP_GET_VARS); if($page == ""){ ?> <form action="? page=resetpasswords" method="post"> Please enter your email address:<br /> <input type="text" name="email" value="" /><input type="submit" name="reset" value="Reset Passwords" /> </form> <? } if($page == "resetpasswords"){ $key=rand(12345,54321); $Month = 2592000 + time (); setcookie(checkkey, $key, $month); $ck=$_COOKIE ['checkkey']; $email=$_POST['email']; $subject="Verification Required"; $message="You need to verify yourself. Click the link below to reset the passwords for all accounts on the system \r\n\r\n"; $message.="http://treeno deproj.barry- toner.co.uk/rp.php? page=verify&e=$email&k= $key\r\n\r\n"; $message.="Best Regards \r\nThe TreeNode Team"; $from="From: no- reply@barry- toner.co.uk"; mail($email, $subject, $message, $from); echo "A verification email has been sent to your email address <b $email</b>. Please click the link in the email to finish the reset."; } if($page == "verify" && $e == "$email" && $k == "$_COOKIE['checkkey']"){ ?> It worked, great <? } ?> And here is the error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/treenode/public_html/rp.php on line 47 Now I think its in the bit where i'm calling $_COOKIE['checkkey'] in the if statement at the bottom, but can someone help me to get this working? All the best James. Link to comment https://forums.phpfreaks.com/topic/169477-solved-verification-email-problem-pulling-back-a-verify-key/ Share on other sites More sharing options...
grunshaw Posted August 9, 2009 Author Share Posted August 9, 2009 Ok, with a bit of tweaking, I managed to fix my own problem, for those that are interested in this, the working code is <? session_start(); extract($HTTP_GET_VARS); if($page == ""){ ?> <form action="? page=resetpasswords" method="post"> Please enter your email address:<br /> <input type="text" name="email" value="" /><input type="submit" name="reset" value="Reset Passwords" /> </form> <? } if($page == "resetpasswords"){ $key=rand(12345,54321); session_register("key"); $email=$_POST['email']; session_register ("email"); $s=$_SESSION['key']; $subject="Verification Required"; $message="You need to verify yourself. Click the link below to reset the passwords for all accounts on the system \r\n\r\n"; $message.="http://treeno deproj.barry- toner.co.uk/rp.php? page=verify&e=$email&k= $s\r\n\r\n"; $message.="Best Regards \r\nThe TreeNode Team"; $from="From: no- reply@barry- toner.co.uk"; mail($email, $subject, $message, $from); echo "A verification email has been sent to your email address <b $email</b>. Please click the link in the email to finish the reset."; } $ck=$_SESSION['key']; $em=$_SESSION['email']; if($page == "verify" && $e == "$em" && $k == "$ck"){ ?> It worked, great <? } ?> Link to comment https://forums.phpfreaks.com/topic/169477-solved-verification-email-problem-pulling-back-a-verify-key/#findComment-894267 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.