-2
我通過implode向user_privilege列添加值,包括用戶的權限,即 (7gz,agt_courses,newbill,new_Trainee)=>他們每個人都可以打開(例如:newbill頁面)或不打開在用戶權限 user_privilege列在數據庫 「登錄」表中的數據庫 換句話說,我想檢查用戶登錄他的權限,如果它有說新手權限,他可以打開新手頁面,如果不是他不能打開此頁面。檢查用戶權限的權限
登錄表數據庫是這樣的:
**username username2 user_privilege**
amal amal 7gz,agt_courses,newbill
ahmed ahmed dataDisplay,previllige,newUsers
$username = $_POST['username'];
$username2 = $_POST['username2'];
if($username && $username2)
{
$finduser = mysqli_query($link,"SELECT * FROM LOGIN
WHERE username='".$username."' AND username2='".$username2."' AND FIND_IN_SET('Customers', user_previllige)") or die("error");
if(mysqli_num_rows($finduser) !=0)
{
while($row = mysqli_fetch_array($finduser))
{$uname = $row['username'];
$uname2 = $row['username2'];}
}
if($username == $uname && $username2 == $uname2)
{$_SESSION['sessionname'] =$uname;
$_SESSION['sessionname2'] =$uname2;
header ("location:../customers/cutomer.php");}
else echo '<script>function
{alert(you have not permission to open this page)}</script>';
}
任何機構幫助我?
哪裏是什麼,你已經嘗試過的代碼? –
我們如何能夠幫助您,而不會看到數據是什麼樣的? – rorypicko