我正在尝试让我的电子邮件验证正常工作。就发送带有哈希链接的电子邮件进行确认而言,一切正常,但是一旦转到下面的 verify.php 链接,它就不会将我的数据库活动行从 0 更新为 1。有什么建议吗?
if(isset($_GET['email']) && !empty($_GET['email']) AND isset($_GET['email_hash']) && !empty($_GET['email_hash'])){
// Verify data
$search = "SELECT email, email_hash, active FROM users WHERE email='".$email."' AND hash='".$email_hash."' AND active='0'";
$match = $database->num_rows( $query );
if($match > 0){
//Fields and values to update
$update = array(
'active' => 1
);
//Add the WHERE clauses
$where_clause = array(
'email' => '$email',
'email_hash' => '$email_hash',
'active' => '1'
);
$updated = $database->update( 'users', $update, $where_clause, 1 );
if( $updated )
{
echo '<p>Your account has been activated, you can now login</p>';
}
}
}else{
echo '<p>Your account is already activated</p>';
}