我现在有一个简单的本地主机网站。我正在处理安全问题。我在数据库中创建了一个额外的列,并将其命名为enum('0','1')类型的“active_notactive”。PHP注销cookie和会话
我的问题:如何将active_notactive费尔德更改为0对特定用户的注销。
我想实现的是:在,active_notactive = '0' 在用户登录之前,之后便登录active_notactive = '1',当他们注销= '0'。我把他们全部从注销位开始工作。
这里是我的注销脚本:
<?php
// start session
session_start();
// HERE IS WHERE IM STUCK
// get session email to use it in the following query
$_SESSION['email'] = $email;
// Update member to active
mysql_query("UPDATE members SET active_notactive='0' WHERE email=$email");
// delete the current dession
unset($_SESSION);
session_destroy();
// set the current cookie to 1 hour ago (to delete it)
setcookie ("online_security_user", "", time() - 3600);
setcookie ("online_security_pass", "", time() - 3600);
?>
<h2>Thank you for using our website. You are now logged out.</h2>
**从不**假定查询成功。如果你有基本的错误处理,例如'mysql_query(...)或死(mysql_error())'你会看到为什么这不起作用。 –