代码如下:
<?php
include "../inc/mysql.inc";
include "../inc/myfunction.inc";
$aa=new mysql;
$bb=new myfunction;
$aa->link("");
$_SESSION[manage_name]="";
$_SESSION[manage_tag]="";
$login=$_POST[login];
if ($login=="登 陆"){
$username=$_POST[username];
$password=$_POST[password];
if ($username!="" && $password!=""){
$query="select * from manage_user_info where user_name='$username'";
$rst=$aa->excu($query);
$user=mysql_fetch_array($rst,MYSQL_ASSOC);
if ($user[user_pw]==$password){
$_SESSION[manage_name]=$user[user_name];
$_SESSION[manage_tag]=1;
header("location:./index.php");
}
}
}
?>
<?php
include "../inc/mysql.inc";
include "../inc/myfunction.inc";
$aa=new mysql;
$bb=new myfunction;
$aa->link("");
$_SESSION[manage_name]="";
$_SESSION[manage_tag]="";
$login=$_POST[login];
if ($login=="登 陆"){
$username=$_POST[username];
$password=$_POST[password];
if ($username!="" && $password!=""){
$query="select * from manage_user_info where user_name='$username'";
$rst=$aa->excu($query);
$user=mysql_fetch_array($rst,MYSQL_ASSOC);
if ($user[user_pw]==$password){
$_SESSION[manage_name]=$user[user_name];
$_SESSION[manage_tag]=1;
header("location:./index.php");
}
}
}
?>
求帮助~~~
header("location:./index.php");
去掉./,这样写:header(location:index.php)
试试
如果后台程序没错,而且点击"登录"没有反应,那就是前段页面有问题。
还有所有html标签的属性最好都用英文,中文会产生许多不必要的麻烦。
Notice: Use of undefined constant username - assumed 'username'
代码写规范点,有花不了多少时间。$_POST['username']