2012-06-28 55 views
-3

当电子邮件激活此错误消息“我们有问题,激活您的帐户”我们有激活您的帐户

任何问题,我的激活码的问题.. ??? 代码下面给出..下面给出

'activate.php'

<?php 
    include 'core/init.php'; 
    logged_in_redirect(); 
    include 'includes/overall/header.php'; 

    if (isset($_GET['success']) === true && empty($_GET['success']) === true) { 
    ?> 
     <h2>Thanks, we've activated your account....</h2> 
     <p>You're free to Log in!</p> 

    <?php 

    } else if (isset($_GET['email'], $_GET['email_code']) === true) { 

     $email  = trim($_GET['email']); 
     $email_code = trim($_GET['email_code']); 

     if (email_exists($email) === false) { 
      $errors[] = 'Oops, something went wrong and we could\'t find that email address'; 
     } else if (activate($email, $email_code) === false) { 
      $errors[] = 'We had problems activating your account'; 
     } 

     if (empty($errors) === false) { 
     ?> 
      <h2>Ooops...</h2> 
     <?php 
      echo output_errors($errors);   
     } else { 
      header('Location: activate.php?success'); 
      exit(); 
     } 

    } else { 
     header('Location: index.php'); 
     exit(); 
    } 

    include 'includes/overall/footer.php'; 
?> 

电子邮件链接代码: * 'user.php的' *

回答

1

activate函数返回false。确保以正确的方式调用它,并且按预期工作。

+0

+1一个非常简洁的答案:) – Junaid

+0

功能激活($电子邮件,$ email_code){ \t $电子邮件\t \t = mysql_real_escape_string($电子邮件); \t $ email_code \t = mysql_real_escape_string($ email_code); (mysql_result(mysql_query(“SELECT COUNT('user_id')FROM'users' WHERE'email' AND'email_code' ='$ email_code'AND'active' = 0”),0)== 1) \t \t if {“更新'用户'设置'活动'= 1在哪里'email' ='$ email'”); \t \t return true; \t \t \t} else { \t \t return false; \t} } 请检查此代码.. ?? – user1482514

+0

我认为你应该自己做一些基本的故障排除。通过在SQL程序中手动运行它们,检查SQL查询是否按预期工作。用'mysql_error'检查错误消息。 –