刚写了一段登录的代码,求大家指点不足之处

lucky_vincent 2005-01-06 11:31:10
<?php
session_start();

?>
<html>
<head>
<title>Admin - Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2313">
<meta http-equiv="Pragma" content="no-cache">


</HEAD>
<body bgcolor="#FFFFFF" background="_image/bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<br><br><br>
<?php

if ($_SERVER[REQUEST_METHOD] == "POST") {
extract($_POST, EXTR_PREFIX_ALL, "extr");
$ip = $_SERVER[REMOTE_ADDR];
$filename = "blockip.php";
include $filename;

if ($ips) {
foreach ($ips as $key => $val) {
if ($ip == $key && '3' == $val) {
die("<font color=red>This IP has be blocked.</font>");
exit;
}
}
}

if ("username" == $extr_usrname && "password" == $extr_usrpwd) {
$_SESSION[dev] = $extr_usrname;
redivert("forum.php");
exit;
} else {

if ($fp = fopen($filename, "w+")) {
$content = "<?php \n\n";
if ($ips) {
foreach ($ips as $key => $val) {
if ($ip == $key) {
$i = 1;
$val++;
}
$content .= '$ips["'. $key. '"] = "'. $val. '";'. "\n";
}
}
if (1 != $i ¦ ¦ !$ips) $content .= '$ips["'.$ip.'"] = "1";'. "\n";
$content .= "\n\n?>";
fwrite($fp, $content);
fclose($fp);
} else {
die("system error.");
}
?>
<center>
<br>
pls try again
<br>
<?php
}
}

?>
<table cellspacing=0 cellpadding=0 border=0 width=350>
<tr><form method=post action=<?$PHP_SELF?>>
<td bgcolor=black><table cellspacing=1 cellpadding=5 width=100% border=0>
<tr>
<Td bgcolor=white>username</td>
<Td bgcolor=white><input type="text" name="usrname"></td>
<tr>
<Td bgcolor=white>password</td>
<Td bgcolor=white><input type="password" name="usrpwd"></td>
<tr><td bgcolor=white> </td>
<td bgcolor=white> <input type=submit name=action value=Submit></td>
</table>
</td></form>
</table>

</body>
</html>
...全文
192 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Cain 2005-01-07
  • 打赏
  • 举报
回复
你这么写,只要用户在登录的时候只要曾经输错过3次密码就被锁住了IP,而不是连续输错3次密码!
netstu 2005-01-07
  • 打赏
  • 举报
回复
不错
raid79 2005-01-06
  • 打赏
  • 举报
回复
up
纯冰糖 2005-01-06
  • 打赏
  • 举报
回复
study...
shuixianzi00 2005-01-06
  • 打赏
  • 举报
回复
偶也要学习使用模板
erldy 2005-01-06
  • 打赏
  • 举报
回复
楼主快点学习使用模板!!
lyneville 2005-01-06
  • 打赏
  • 举报
回复
天呀,这是…… ^_^
  • 打赏
  • 举报
回复
wy2000490 2005-01-06
  • 打赏
  • 举报
回复
你可以说说你的思路,大家才可以帮帮你,你什么都不说?说清楚

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧