求救,关于PHP的登入次数系统问题。 (紧急) if($loginErrorV){ if(isset($_COOKIE['login'])){ if($_COOKIE['login']<3){ header('Location:login.php'); $attempts = $_COOKIE['login'] + 1; } else { header('Location:register.php'); } }}你不是已經寫好了嗎 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 原來你沒有set cookie,所以不行。if($loginErrorV){ if(isset($_COOKIE['login'])){ if($_COOKIE['login']<3){ setcookie("login",$_COOKIE['login'] + 1, time()+3600*24); header('Location:login.php'); $attempts = $_COOKIE['login'] + 1; } else { header('Location:register.php'); } }else{ setcookie("login",0, time()+3600*24); }} cookie也可以实现,if (isset($_COOKIE['user']) && isset($_COOKIE['login_times'])) { setcookie("login_times", $_COOKIE['login_times']+1, time()+3600); echo $_COOKIE['user'] . "<br/>"; echo $_COOKIE['login_times']; if ($_COOKIE['login_times'] > 3) { setcookie("user", "", time()-3600); setcookie("login_times", "", time()-3600); header("Location:user.php?act=register_page"); } } else { setcookie("user", $user_arr[0]['user_name'], time()+3600); setcookie("login_times", 1, time()+3600); }如果需要行为分析:可以用一个新表来记录用户的登录和注册行为 对于系统的分析和统计会更好CREATE TABLE `user_log` ( `id` int(6) NOT NULL AUTO_INCREMENT, `user_id` int(6) NOT NULL, `user_action` int(1) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8加上时间字段,登录失败,在一定时间范围内锁定账号,统计查询失败次数,登录失败新增对应记录 这个怎么跑起来啊。。。 逻辑关系匹配 joomula 做的网站怎么在本机运行 PHP程序在mysql字段中保存html代码问题. 如何在PHP WEB页面点击链接执行SHELL脚本 如何用php同时连接mssql和sybase 新手问题:如何判断会员身份(最好能给出详解,分不够可以加) 请问kt133 在PHP中用什么方法可以替代ASP中的Application? preg_replace改写preg_replace_callback的问题 php正则排除某些字符 求朋友指点淘宝订单合并,快递单号推送接口问题
if($loginErrorV){
if(isset($_COOKIE['login'])){
if($_COOKIE['login']<3){
setcookie("login",$_COOKIE['login'] + 1, time()+3600*24);
header('Location:login.php');
$attempts = $_COOKIE['login'] + 1;
} else {
header('Location:register.php');
}
}else{
setcookie("login",0, time()+3600*24);
}
}
setcookie("login_times", $_COOKIE['login_times']+1, time()+3600);
echo $_COOKIE['user'] . "<br/>";
echo $_COOKIE['login_times'];
if ($_COOKIE['login_times'] > 3) {
setcookie("user", "", time()-3600);
setcookie("login_times", "", time()-3600);
header("Location:user.php?act=register_page");
}
} else {
setcookie("user", $user_arr[0]['user_name'], time()+3600);
setcookie("login_times", 1, time()+3600);
}如果需要行为分析:可以用一个新表来记录用户的登录和注册行为 对于系统的分析和统计会更好
CREATE TABLE `user_log` (
`id` int(6) NOT NULL AUTO_INCREMENT,
`user_id` int(6) NOT NULL,
`user_action` int(1) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8
加上时间字段,登录失败,在一定时间范围内锁定账号,统计查询失败次数,登录失败新增对应记录