代码如下:<?php
session_start();
include('../inc/conn.php');
opendb();
$action = $_REQUEST["action"];
if ($action = "admin_login")
{
$username = $_POST["username"];
$password = $_POST["password"];
$vertifycode = $_POST["vertifycode"];
if ( !$username && !$password && !$vertifycode)
{
echo "<script>alert('登陆信息填写不完整!请返回重新填写!');history.go(-1);</script>";
exit;
}
if ($vertifycode != $_SESSION['VCODE'])
{
echo "<script>alert('验证码填写错误!请返回重新填写!');history.go(-1);</script>";
exit;
}
$sql = "select * from Admin where name = '".$username."' and password = '".md5($password)."'";
$result = mysql_query($sql);
$counts = mysql_num_rows($result);
if ($counts == 0 )
{
echo "<script>alert('用户名或密码错误!请返回重新填写!');history.go(-1);</script>";
exit;
} else {
header('location:index.php');
$_SESSION['username'] = $username;
}
}
?>错误如下:Warning: Cannot modify header information - headers already sent by
session_start();
include('../inc/conn.php');
opendb();
$action = $_REQUEST["action"];
if ($action = "admin_login")
{
$username = $_POST["username"];
$password = $_POST["password"];
$vertifycode = $_POST["vertifycode"];
if ( !$username && !$password && !$vertifycode)
{
echo "<script>alert('登陆信息填写不完整!请返回重新填写!');history.go(-1);</script>";
exit;
}
if ($vertifycode != $_SESSION['VCODE'])
{
echo "<script>alert('验证码填写错误!请返回重新填写!');history.go(-1);</script>";
exit;
}
$sql = "select * from Admin where name = '".$username."' and password = '".md5($password)."'";
$result = mysql_query($sql);
$counts = mysql_num_rows($result);
if ($counts == 0 )
{
echo "<script>alert('用户名或密码错误!请返回重新填写!');history.go(-1);</script>";
exit;
} else {
header('location:index.php');
$_SESSION['username'] = $username;
}
}
?>错误如下:Warning: Cannot modify header information - headers already sent by
参考方案ultraedit 打开一个新文件然后另存为时选择“utf-8 无BOM”