seeion_start()和header()不能用,求达人指教!??QQ21429503
seeion_start()和header()不能用,求达人指教!??QQ21429503
数据库正常使用,环境winxp,apache,php5,mysql
我怀猜想是php.ini配置问题,但其它正常,就是这两个库函数不能用(其它的还不知道)
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Apache2\htdocs\conn.php:4) in C:\Apache2\htdocs\checklogin.php on line 3
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Apache2\htdocs\conn.php:4) in C:\Apache2\htdocs\checklogin.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at C:\Apache2\htdocs\conn.php:4) in C:\Apache2\htdocs\checklogin.php on line 14
logo.php
<table width="100%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<form action="checklogin.php" method="post"><td align="center" valign="middle"><table width="400" border="0" cellpadding="5" cellspacing="1" class="tablebg">
<tr class="tdbg">
<td colspan="2"><div align="center">Administrators Login</div></td>
</tr>
<tr class="tdbg">
<td><div align="center">Username</div></td>
<td><div align="center">
<input name="username" type="text" id="username">
</div></td>
</tr>
<tr class="tdbg">
<td><div align="center">Password</div></td>
<td><div align="center">
<input name="password" type="password" id="password">
</div></td>
</tr>
<tr class="tdbg">
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Submit">
<input type="reset" name="Submit2" value="Clear">
</div></td>
</tr>
</table></td></form>
</tr>
</table>
checklogin.php
<?
require_once('conn.php');
session_start();
$username=$_POST['username'];
$password=$_POST['password'];
$exec="select * from shop where user='".$username."'";
if($result=mysql_query($exec))
{
if($rs=mysql_fetch_object($result))
{
if($rs->pwd==$password)
{
$_SESSION['adminname']=$username;
header("location:index.php");
}
else
{
echo "<script>alert('Password Check Error!');location.href='login.php';</script>";
}
}
else
{
echo "<script>alert('Username Check Error!');location.href='login.php';</script>";
}
}
else
{
echo "<script>alert('Database Connection Error!');location.href='login.php';</script>";
}
?>