我在一個簡單的PHP MySQL的&專科層次的管理體系......所有員工和學生有自己的賬戶工作訪問多ACCESSLEVEL ..我想顯示自己的頁面
在我案例3級管理員,老師,學生 如果學生登錄,或管理員登錄,老師登錄 如何去自己的頁面如何?幫我請即時biggnering ... 我的代碼是如何在PHP和MySQL
if(count($_POST)>0) {
$qr = "SELECT * FROM users WHERE username='" . $_POST["username"] . "' and password = '". $_POST["password"]."' and accessLevel ='".$_POST['role']."'";
$res = mysql_query($qr) or die($qr);
if(mysql_num_rows($res) > 0)
{
$row = mysql_fetch_array($res);
$_SESSION['u_id'] = $row['u_id'];
$_SESSION['username'] = $row['username'];
//echo $_SESSION['u_id']; die();
}
else {
$message = "Invalid Username or Password!";
}
}
if(isset($_SESSION["u_id"])) {
header("Location: admin_home.php");
}
?>
<form class="form-horizontal" action="" method="post">
<fieldset>
<div class="input-prepend" title="Username" data-rel="tooltip">
<span class="add-on"><i class="icon-user"></i></span><input autofocus class="input-large span10" name="username" id="username" type="text" value="admin" />
</div>
<div class="clearfix"></div>
<div class="input-prepend" title="Password" data-rel="tooltip">
<span class="add-on"><i class="icon-lock"></i></span><input class="input-large span10" name="password" id="password" type="password" value="admin123456" />
</div>
<div class="clearfix"></div>
<div class="control-group">
<label class="control-label" for="selectError3">Plain Select</label>
<div class="controls">
<select id="selectError3" name="role" id="role">
<option>Admin</option>
<option>Teacher</option>
<option>Student</option>
</select>
</div>
</div>
<div class="input-prepend">
<label class="remember" for="remember"><input type="checkbox" id="remember" />Remember me</label>
</div>
<div class="clearfix"></div>
<p class="center span5">
<button type="submit" class="btn btn-primary">Login</button>
</p>
</fieldset>
</form>
什麼''幫助我請即時通訊biggnering ...我的代碼是「'甚至是什麼意思? – royhowie
我懷疑它的意思是「我是一個英語爲第二語言的人,他沒有閱讀[幫助]中的指導方針,特別是沒有關於[MCVE]的網頁(http://stackoverflow.com/hlpe/mcve) ,我是一個編程初學者,這是我整個程序,我希望你調試「 – GreenAsJade