📄 inde.php
字号:
<?php
session_start();
$login="yes";
session_register('login');
@$login_name=$_POST['login_name'];
@$login_pwd=$_POST['login_pwd'];
@$action=$_POST['action'];
if($action)
{
$cn=mysql_connect('localhost','root','');
$strl="DELETE FROM `user_id` WHERE `user_id` != '' ;";
mysql_db_query("yonghu",$strl,$cn);
$strsql="SELECT * FROM `client` WHERE `username` = '$login_name' AND `password` = '$login_pwd'";
$result=mysql_db_query("yonghu",$strsql,$cn);
$user=mysql_fetch_array($result);
if(empty($user))
{ mysql_close();
echo "<script language='javascript'>";
echo "alert(\"您的登陆信息有误!\");";
echo "window.location='index.php'";
echo "</script>";
}
if(!empty($user))
{
$str="INSERT INTO `user_id` (`user_id`) VALUES ('$login_name');";
mysql_db_query("yonghu",$str,$cn);
mysql_close();
header("location:index.php");
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script language="javascript">
function checklogin()
{
if((login.login_name.value!="") && (login.login_pwd.value!=""))
return ture
else{
alert("帐号或密码不能为空!")
return false
}
}
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网上购物</title>
<style type="text/css">
<!--
.style1 {
font-size: xx-large;
font-weight: bold;
}
.style3 {font-size: large}
-->
</style>
</head>
<body>
<form name="login" method="post" action="" onSubmit="return checklogin()">
<table width="100%" border="0" cellspacing="1">
<tr>
<td height="80"><div align="center" class="style1"> 网上购物</div></td>
</tr>
</table>
<input type="hidden" name="hiddenField">
<table width="100%" border="0" cellspacing="1">
<tr>
<td width="13%" height="42"><span class="style3"><a href="index.php">超市首页</a></span></td>
<td width="11%"><span class="style3"><a href="zhuce.php">我要注册</a>
</span></td>
<td width="11%"><span class="style3"><a href="xianshi.php">用户资料</a></span></td>
<td width="14%" class="style3"><a href="xiugai.php">修改资料</a></td>
<td width="12%" class="style3"><a href="process.php">订单查询</a></td>
<td width="15%"><span class="style3"><a href="chaxun.php">物品查询</a></span></td>
<td width="24%"><span class="style3"><a href="process1.php">我的购物车</a></span></td>
</tr>
</table>
<div align="left">
<table width="32%" border="0" cellspacing="1">
<tr>
<td width="55%"><div align="left"> <span class="style3"> </span>用户名: <span class="style3">
</span></div></td>
<td width="25%">
<div align="left">
<p class="style3">
<input name="login_name" type="text" id="login_name">
</p>
</div>
</td>
</tr>
<tr>
<td><div align="left">密码:</div></td>
<td> <div align="left">
<p>
<input name="login_pwd" type="password" id="login_pwd">
</p>
</div>
</td>
</tr>
<tr>
<td height="40" colspan="2"><div align="left">
<div align="center">
<input type="submit" name="Submit" value="登录">
<input type="text" name="action" value="yes" style="display:none ">
<input type="reset" name="Submit2" value="重填">
</div>
</form>
</div></td>
</tr>
</table>
</div>
<p> </p>
<p align="left"> </p>
<p align="left"> </p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -