Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>session and include functions are given:</p> <pre><code> session_start(); include("config.php"); if(isset($_POST['T_UserName']) &amp;&amp; isset($_POST['T_Password']) &amp;&amp; !empty($_POST['T_UserName']) &amp;&amp; !empty($_POST['T_Password'])) { </code></pre> <p>username and password sent from form:</p> <pre><code> $T_UserName=$_POST['T_UserName']; $T_Password=$_POST['T_Password']; </code></pre> <p>To protect MySQL injection:</p> <pre><code> $T_UserName = stripslashes($T_UserName); $T_Password = stripslashes($T_Password); $T_UserName= mysql_real_escape_string($T_UserName); $T_Password = mysql_real_escape_string($T_Password); $sql="SELECT * FROM login WHERE username='$T_UserName' and password='$T_Password'"; $result=mysql_query($sql); </code></pre> <p>Mysql_num_row is counting table row:</p> <pre><code> $count=mysql_num_rows($result); </code></pre> <p>If result matched $T_UserName and $T_Password, table row must be 1 row :</p> <pre><code> if($count==1) { </code></pre> <p>Register $T_UserName, $T_Password and redirect to file "correspindex.php" : </p> <pre><code> session_register("T_UserName"); session_register("T_Password"); </code></pre> <p>redirect to error page or display error message then :</p> <pre><code> if(isset($_POST['emp_role']) { $userinfo = mysql_fetch_assoc($sql); $emp_role = $userinfo['emp_role']; if($emp_role == 1) { header("location:corrrespondindex.php"); } elseif($emp_role == 2 ) { header("location:principalindex.php"); } elseif($emp_role == 3) { header("location:staffindex.php"); } closes out if the user DOES exist: header("location:loginhome.php"); } else { echo "Wrong Username or Password"; } } } php is closed this is the php code im getting so many error i create 1table with id,username,password and role(ENUM,values as'1','2','3' – any else shud i do in the code??? </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.
    1. This table or related slice is empty.
    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