Advertisement
Guest User

Untitled

a guest
Jun 7th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.12 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. <html>
  55. <head>
  56. <title>member Log-in</title>
  57. </head>
  58.  
  59. <body>
  60. <center>
  61. <Form action = '[login].php' method='POST'>
  62. <table border="0" background = "white.png" width= 800 height= 600>
  63. <tr>
  64. <td>
  65. <center>
  66. <center>Email <input type = 'text' name = 'email'><br>
  67. <center>Password <input type = 'password' name = 'password'><br><br>
  68. <center><input type = submit value = "Log In"><br>
  69.  
  70. <center><a href='index.html'>Back to Home</a><br>
  71. </form>
  72. </body>
  73.  
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement