<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>登录页面</title> </head> <body> <form action="login.php" method="post"> 用户名:<input type="text" name="username" /><br /> 密码:<input type="password" name="password" /><br /> <input type="submit" value="登录" /> </form> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>登出页面</title> </head> <body> <?php session_start(); session_destroy(); ?> <script> window.location.href="login.html"; </script> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登陆中……</title>
</head>
<body>
<?php
session_start();
$username=$_REQUEST["username"];
$password=$_REQUEST["password"];
$con=mysql_connect("localhost","root","root");
if(!$con){
die("数据库连接失败!");
}
mysql_select_db("test",$con);
$dbusername=null;
$dbpassword=null;
$result=mysql_query("select * from user where username='".$username."';");
while($row=mysql_fetch_array($result)){
$dbusername=$row["username"];
$dbpassword=$row["password"];
}
if(is_null($dbusername)){
?>
<script>
alert("查无此人!");
window.location.href="login.html";
</script>
<?php
}
else{
if($dbpassword!=$password){
?>
<script>
alert("密码错误!");
window.location.href="login.html";
</script>
<?php
}
else{
$_SESSION["username"]=$username;
$_SESSION["code"]=mt_rand(0,100000);
?>
<script>
window.location.href="welcome.php";
</script>
<?php
}
}
mysql_close($con);
?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>欢迎登录</title>
</head>
<body>
<?php
session_start();
if(isset($_SESSION["code"])){
?>
欢迎登录!<?php
echo "${_SESSION["username"]}";
?><br />
你的IP:<?php
echo "${_SERVER['REMOTE_ADDR']}";
?>
<br />
你的系统语言:<?php
echo "${_SERVER['HTTP_ACCEPT_LANGUAGE']}";
?>
<br />
你的浏览器为:<?php
echo "${_SERVER['HTTP_USER_AGENT']}";
?>
<br />
<a href="exit.php">退出登录</a>
<?php
}
else{
?>
<script>
alert("请正常登录!");
window.location.href="exit.php";
</script>
<?php
}
?>
</body>
</html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有