激活PHP电子邮件dosn工作

时间:2014-04-18 18:09:51

标签: php mysql hyperlink

我想让新用户通过cliknig点击emial电子邮件中的链接来激活他们的帐户,但是这个代码没有发生什么问题?

这是我打开激活电子邮件链接后得到的内容

ACTIVATION RESULTS

Your account could not be activated!

';} elseif ($doublecheck > 0) { echo "

Your account has been activated!

 Click Here to log in now.

  "; } ?> 

她是我的PHP代码

 include_once "connect_to_mysql.php";
// Get the member id from the URL variable
$id = $_REQUEST['id'];
$id = ereg_replace("[^0-9]", "", $id); // filter everything but numbers for security
if (!$id) {
echo "Missing Data to Run";
exit(); 
 }
 // Update the database field named 'email_activated' to 1
 $sql = mysql_query("UPDATE members SET emailactivated='1' WHERE id='$id'"); 
 // Check the database to see if all is right now 
  $sql_doublecheck = mysql_query("SELECT * FROM members WHERE id='$id' AND emailactivated='1'"); 
    $doublecheck = mysql_num_rows($sql_doublecheck); 
  if($doublecheck == 0){ 
  // Print message to the browser saying we could not activate them
 echo '<br /><br /><div align=\"center\"><h3><strong><font color=red>Your account could    not be activated!</font></strong><h3><br /></div>';} 
 elseif ($doublecheck > 0) {

echo "<br /><br /><h3><font color=\"#0066CC\"><strong>Your account has been activated!      <br /><br />
   </strong></font><a href='login.php'>Click Here</a> to log in now.</h3>"; 
 } 
 ?> 

0 个答案:

没有答案