📄 login.php
字号:
<?php
include_once"config.php";
$usern=$_GET['username'];
$passw=$_GET['password'];
if(isset($ok))
{
if($usern=="")
{ $info="请输入用户名"; header("location:index.php?info=$info"); exit; }
else
{ if($passw=="")
{ $info="请输入密码"; header("location:index.php?info=$info"); exit; }
else
{
$conn=mysql_connect($Host,$User,$Password);
$sql="select * from counter where username='$usern'";
mysql_select_db($Database,$conn);
$result=mysql_query($sql);
if($result)
{ $row=mysql_fetch_array($result);
$dbusername=$row['username'];
$dbuserpass=$row['userpass'];
mysql_close($conn);
if($dbusername==$usern and $dbuserpass==md5($passw))
{ session_start(); session_register("switch"); session_register("name"); //这两行是传递权限参数
$_SESSION['switch']=1; $_SESSION['name']=$dbusername; //到index.php页面的
header("location:index.php"); exit; }
else
{ $info="登陆失败"; header("location:index.php?info=$info"); exit; }
}
else echo "Check Error";
}
}
}
else echo "Not Submit";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -