.创建一个php动态网页,

2024年11月16日 03:19
有2个网友回答
网友(1):

你是要PHP 写sql语句吗 include "./inc/db.inc.php";

$member_num = mysql_query("SELECT COUNT(id) FROM renwu_member");

$member_num = mysql_fetch_row($member_num);

echo "

管理员:".$userid."  ";
echo "注册情况:".$member_num[0]."/".$maxmember."  ";
echo "档案保存时限:".$data_day."天";

mysql_close();
?>
if($login == 1){
include "./inc/db.inc.php";

$user_id = $T1;

$user_login = mysql_query("SELECT name,pw FROM renwu_member WHERE id='$user_id'");
if(!@mysql_num_rows($user_login)){
echo "


";
echo "抱歉!没有这个帐号\n";
echo "后退\n";
exit();
}else{
$password = mysql_result($user_login,0,"pw");
if($password == $T2){
$user_name = mysql_result($user_login,0,"name");
session_register("user_id");
session_register("user_name");
$nowtime = time();

//IP,ID检查
$now_ip = $REMOTE_ADDR;
$distance_time = $nowtime - 3600;
mysql_query("DELETE FROM ip_date WHERE login_time<'$distance_time'");
$ip_info = mysql_query("SELECT id FROM ip_date WHERE ip='$now_ip' ORDER BY login_time DESC");
$id = @mysql_result($ip_info,0,"id");
/*if($id != $user_id && $id != "" && $now_ip != "61.133.169.238"){
echo "


";
echo "系统检测到你试图在短时间内同时登陆两个ID,这已被视为非法行为!\n";
echo "后退\n";
exit();
}*/
mysql_query("INSERT INTO ip_date VALUES('$user_id','$now_ip','$nowtime')");
echo "";

mysql_query("UPDATE misc SET logintime='$nowtime' WHERE id='$user_id'");

//数据保存天数查询
$limit_time = time() - $data_day * 86400;
$del_person = mysql_query("SELECT id FROM misc WHERE logintime < '$limit_time'");
$del_num = mysql_num_rows($del_person);
for($i=0;$i<$del_num;$i++){
$del_id = mysql_result($del_person,$i,"id");
include "./include/data_del.inc.php";
}
mysql_close();

exit();
}else{
echo "


";
echo "登陆密码出现错误,用户".$user_id."不能进入\n";
echo "后退\n";
exit();
}
}
}
?>

网友(2):

addslashes("字符串")