0

how to admin and user to login in the same interface but after login admin will go to page register staff. while the user will go to search page staff who have been on the list by admin. what are the steps that need to be placed and coding for this situation ? please help me :(

5
Contributors
6
Replies
26
Views
2 Years
Discussion Span
Last Post by hiren2927
0

It depends on how you divide normal users from admin users in your DB. If for example you divide them let's say with a "level" value and admin is set to 0 and normal user to 1 the thing becomes quite simple! After checking the user credentials you can retrive the user level and if the level returns "0" you redirect to the admin interface and if the user level is "1" you send the user to the normal user interface.

0

Paste your code here noone can help you this way.You have to do some thing yourself and then others can help you out.

0

u just have to put condition on loginform and u can redirect ur pages to admin and user

0
<?php
session_start();
include("connection.php");
?>
<?php
$count="";
if(isset($_POST['sub']))
{
   if($_POST['txt_user']=="")
   {
      ?>
      <script>alert("please enter user name");</script>
      <?php
      $count++;
   }
   if($_POST['txt_pass']=="")
   {
   ?>
   <script>alert("please enter password");</script>
   <?php
   $count++;
   }
   }
?>
<?php
if(isset($_POST['sub']) && $count==0)
{
    $f_name=$_POST['txt_user'];
    $password=$_POST['txt_pass'];

  $select="select * from log_in where username='".$f_name."' and password='".$password."'";
  $query=mysql_query($select);
  $row=mysql_fetch_array($query);
  if($row['username']==$_POST['txt_user'] && $row['password']==$_POST['txt_pass'])
  {
    $_SESSION['f_name']=$row['username'];
    ?>
    <script>window.location="book.php";</script>
    <?php
  }
   else
     {
  ?>
  <script>alert("Username or Password Invalid");</script>
  <?php
     }
 }
?>

<form method="post">
  <table>
     <tr>
        <td colspan="2" align="center">Log In</td>
     </tr>
     <tr>
        <td>Username</td>
        <td><input type="text" name="txt_user"  ></td>
     </tr>
     <tr>
        <td>Password</td>
        <td><input type="password" name="txt_pass" ></td>
     </tr>
     <tr>
         <td colspan="2" align="center"><input type="submit" name="sub" value="Log in"></td>
     </tr>

  </table>
</form>
0

just put ur query at at 'else' statement to fetch user table data than u can login to user and admin which u want

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.