Note that there are some explanatory texts on larger screens.

plurals
  1. POwhat's wrong in this code of privilege?
    primarykey
    data
    text
    <p>how to check privilege in "check"php code or page ??</p> <p>I using explode and in_array</p> <p>after the user log in and in "check" page the code must check privilege of user if he has "dataDisplay" privilege or not ..but the code in "check" page doesn't do that </p> <p>what's my wrong in "check" page code </p> <p>this is my Database:</p> <pre><code>+--------------------+-------------------------------+ | username | user_privilege | |--------------------|-------------------------------| | amal |7gz,agt_courses,newbill | | | | +----------------------------------------------------+ | | | | ahmed |dataDisplay,previllige,newUsers| +----------------------------------------------------+ </code></pre> <p>first page "login" php:</p> <pre><code>&lt;?php ob_start(); session_start(); include '../connection/connect.php'; $username = $_POST['username']; $password = $_POST['password']; if($username &amp;&amp; $password ){ $finduser = mysqli_query($link,"SELECT * FROM LOGIN WHERE username = '".$username."' AND password = '".$password ."'") or die("error"); if(mysqli_num_rows($finduser) !=0){ while($row = mysqli_fetch_array($finduser)){ $uname = $row['username']; $pass= $row['password ']; $arr=explode(",",$row['user_privilege']); } } { $_SESSION['sessionname'] =$uname; $_SESSION['sessionpass'] =$password ; $_SESSION['sessionpre'] =explode(",",$row['user_previllige']); header ("location:../agtSite/agt2.php"); } } ob_end_flush(); ?&gt; </code></pre> <p>second page "check" php:</p> <pre><code>&lt;?php session_start(); $_SESSION['sessionpre']=''; $haspermission =in_array("dataDisplay",$_SESSION['sessionpre']); if( $haspermission ) { header("location: agt2.php"); } else{header("location: ../display/display.php");} ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload