我知道這個簡單的問題,在我的程序會話變量已經正常工作,但現在它顯示一些錯誤。我在session_start(); ob_start();
的配置頁面開始會話然後在所有頁面中包含此頁面。但是,如果運行這個程序我收到此錯誤信息:會話變量在php
無法發送會話緩存限制器 - 頭已經發出已
如果刪除包含的配置頁面中的會話變量是notworking。
session_start();
ob_start();
$dbcont = mysql_connect("localhost","root","");
mysql_select_db("emplist",$dbcont);
if($_POST["subSubmit"]=="Submit") {
$user = $_POST["txtUsername"];
$pass = $_POST["txtPassword"];
if ($user == "user" && $pass == "pass") {
$_SESSION["uaid"] = "ADMIN SECTION";
header("Location:welcome.php");
exit();
}else{
$err = "Login Failed. Check You UserID/Password";
}
}
?>
<html>
<head>
<title>.:: Employee Management ::.</title>
</head>
<body>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="form1" id="form1" onSubmit="return checklogin();">
USER ID : <input type="text" name="txtUsername" id="txtUsername" onKeyUp="return clearerr();">
PASSWORD : <input type="password" name="txtPassword" id="txtPassword" onKeyUp="return clearerr();">
<input type="submit" class="FormButton" name="subSubmit" id="subSubmit" value="Submit">
<input type="reset" class="FormButton" name="butReset" id="butReset" value="Reset">
</form>
</body>
</html>
這是我的主頁代碼。如果登錄成功,那麼控件將被移動到該頁面中的「Welcome.php」頁面,我只是回顯會話變量。
請張貼代碼 – 2010-09-25 05:35:27