Advertisement
Guest User

Untitled

a guest
Jun 7th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.69 KB | None | 0 0
  1. <?php
  2.     session_start();   
  3.  
  4.     $host = "localhost";
  5.     $user = "root";
  6.     $pass = "";
  7.     $db = "jobx";
  8.  
  9.     $email = $_POST['email'];
  10.     $password = $_POST['password'];
  11.  
  12.     $link = mysqli_connect($host, $user, $pass, $db);
  13.  
  14.    
  15.     // STUDENTS'/ REGISTRARS' DETAILS
  16.     $query1 = "SELECT * FROM xuser, xrole WHERE xuser.role_id = xrole.role_id AND email = '$email' AND password = SHA1('$password') ";
  17.     $result1 = mysqli_query($link, $query1) or die(mysqli_error($link));
  18.     $row1 = mysqli_fetch_array($result1);
  19.    
  20.     $_SESSION['name'] = $row1['name'];
  21.     $_SESSION['email'] = $row1['email'];
  22.    
  23.     //member role
  24.     if($row1['xuser.roles_id'] == 2){
  25.         echo "<font color='black'>";
  26.         echo "<p>You have successfully logged in as <b>".$role."</b>, <b>".$_SESSION['name']." (".$_SESSION['email'].")</b><p>";
  27.         echo "Your Graduation session details are as the followings:";
  28.         echo "<table border='3' cellpadding='3'>";
  29.         echo "<tr>";
  30.         echo "<td><b>Student ID:</b></td> <td><b>Name:</b></td> <td><b>School (Diploma):</b></td> <td><b>Session ID:</b></td>";
  31.         echo "<td><b>Venue:</b></td> <td><b>Date:</b></td> <td><b>Time:</b></td>";
  32.         echo "</tr>";
  33.         echo "Click here to <a href='rsvp.php'>RSVP</a> now. </font>";
  34.         echo $msg ;
  35.     }
  36.    
  37.     //admin role
  38.     else if($row1['xuser.roles_id'] == 3){
  39.             echo "<font color='black'>";
  40.         echo "<p>You have successfully logged in as <b>".$role."</b>, <b>(".$_SESSION['email'].")</b>
  41.         <p>Click here to go to <a href = 'admin.html'>Admin </a> Page.</font>";
  42.         echo $msg;
  43.     }
  44.    
  45.     else{
  46.             echo "<font color='black'>";
  47.         echo "<p>You have entered an invaild username or password.<p>";
  48.         echo "Login <a href ='login.html'>here</a></font> ";
  49.         echo $msg;
  50.     }
  51.    
  52. ?>
  53.  
  54. </fieldset>
  55. </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement