@header('Content-type:text/html;charset=utf-8');
@session_start();
//$UserName=$_POST['User'];
//$Pwd=$_POST['Pwd'];
echo($_POST['User']);
if($_POST['User']!=null && $_POST['Pwd']!=null)
{
$connect=mysql_connect("127.0.0.1","root","123456");
if(!$connect)
{
die('链接数据库失败'.mysql_error());
}
else
{
mysql_select_db("myschool",$connect)or die(mysql_error());
$sql="SELECT * FROM adminid WHERE Name like '{$_POST['UserName']}' and Pwd like '{$_POST['Pwd']}' ";
$result=mysql_query($sql,$connect) or die(mysql_error());
if(mysql_num_rows($result)>0)
{
//$row=mysql_fetch_array($query);
$false=strval(mysql_fetch_array($result));
echo('查询成功'.$result);
while($row = mysql_fetch_array($result))
{
//echo('数据'.$row);
$_SESSION['Name']=$row['Name'];
echo('登录成功!!!');
@header("Location:School.php");
}
echo('1');
mysql_close($connect);
}
else
{
echo('登录失败!!!'.mysql_num_rows($result));
mysql_close($connect);
@header("Location:SchoolLogin.php");
}
}
}
?>
展开