PHP Admin & student login page issue !!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sandyyyy35
    New Member
    • May 2013
    • 21

    PHP Admin & student login page issue !!

    hi there,

    I am asking that, is this possible to show links from admin page when admin login to the page in php. and when student login the admin links get hidden.

    if yes please provide me the code for the same.
  • rantrave13
    New Member
    • Jun 2013
    • 2

    #2
    use SESSION variables
    from login, save it in a session
    after a successful login, check the user's credentials
    im assuming your data is already saved in a table (user name's,user level's, etc.)
    then just check it if its an admin

    Code:
    <?php if($_SESSION['user_level'] == "admin"): ?>
    <a href="#">Dashboard</a>
    <?php endif; ?>

    Comment

    • raorafique
      New Member
      • Jun 2013
      • 3

      #3
      You can accomplish this with the followings:

      Let us suppose your database tables contains fields username, user_type etc.

      user_type can be "admin" or "student"

      Then after login you can save this user_type to Session variable like this:

      Code:
      // $user_type is the value of relevant field.
      
      $_Session['user_type']=$user_type
      
      if($_Session['user_type']=="admin"){
      //display admin links
      }else{
      //display student links
      }
      Thanks.

      Comment

      Working...