2012-06-28 94 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'檢查錯誤消息。 –