无法使用PDO验证用户帐户,空白页

时间:2013-12-21 18:34:38

标签: php mysql pdo phpmyadmin

为什么我验证用户帐户的代码会产生空白页?

我正在使用此作为文件来激活电子邮件中的帐户,并且它显示为空白。

我很抱歉上一篇愚蠢的帖子..我粘贴了错误的代码,这里是仍然生成空白页面的文件..

verify.php

    //Require Database Stuff
require("database.class.php");
require("user.php");

if(isset($_GET['email']) && !empty($_GET['email']) AND isset($_GET['hash']) && !empty($_GET['hash']))
{
    $verify = $db->prepare('UPDATE users SET active=:active WHERE active=0 AND email=:email and active=:active');
    $status = $verify->execute(array(':active' => 1));

    if( $status )
    {
        echo '<p>Your account has been activated, you can now login.</p>';
    } else {
        echo '<p>Account already active, or account does not exist.</p>';
    }    

}else{

        echo "<p>Invalid URL.</p>";
    }

}

1 个答案:

答案 0 :(得分:0)

试试这个,添加了':email'=>$_GET['email']

 $verify = $db->prepare('UPDATE users SET active=:active WHERE active=0 AND email=:email');
 $status = $verify->execute(array(':active' => 1, ':email'=>$_GET['email']));