Guest User

Untitled

a guest
Dec 4th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Login Form </title>
  6. <link rel="stylesheet" type="text/css" href="style.css">
  7. <link rel="stylesheet" type="text/css" href="styles1.css"
  8. </head>
  9. <body>
  10.  
  11. <h1>
  12.  
  13. <span>E</span>
  14. <span>Z</span>
  15. <span> </span>
  16. <span>G</span>
  17. <span>R</span>
  18. <span>A</span>
  19. <span>D</span>
  20. <span>I</span>
  21. <span>N</span>
  22. <span>G</span>
  23. <span> </span>
  24. <span>S</span>
  25. <span>Y</span>
  26. <span>S</span>
  27. <span>T</span>
  28. <span>E</span>
  29. <span>M</span>
  30. </h1>
  31.  
  32. <div class="loginBox">
  33. <img src="user.png" alt="user" class="user"><br>
  34. <br>
  35. <br>
  36. <br>
  37. <h2 >Log in Here</h2>
  38. <form method="POST" >
  39.  
  40. <select name = "type">
  41. <option value="-1">Login As
  42. </option>
  43. <option value="Admin">Admin</option>
  44. <option value="Student">Student</option>
  45. <option value="Teacher">Teacher</option>
  46. </select></td>/
  47.  
  48.  
  49. <p>Username</p>
  50. <input type="text" name="username" placeholder="Enter your username here">
  51. <p>Password</p>
  52. <input type="password" name="password" placeholder="Enter password here">
  53. <input type="submit" name="" value="Sign In">
  54.  
  55.  
  56.  
  57. </form>
  58. <br><br><br>
  59.  
  60.  
  61.  
  62. </div>
  63.  
  64. </body>
  65. </html>
  66. <?php
  67. $con =mysql_connect("localhost","root","");
  68. if(!$con)
  69. {
  70. echo "unable to establish connection".mysql_error();
  71. }
  72. $db=mysql_select_db("ezgradingsystem",$con);
  73. if(!$db)
  74. {
  75. echo "Database not found".mysql_error();
  76. }
  77.  
  78. if(isset($_POST['submit']))
  79. {
  80.  
  81. $type=$_POST['type'];
  82. $username=$_POST['username'];
  83. $password=$_POST['pwd'];
  84. $query="select * from loginform where username='$username' and password ='$password'and type='$type'";
  85. $result=mysql_query($query);
  86. while($row=mysql_fetch_array($result))
  87. {
  88. if($row['username']==$username && $row['password']==$password && $row['type']=='admin')
  89. {
  90.  
  91. header("Location: admin.html");
  92. }
  93. elseif($row['username'] ==$username && $row['password']==$password && row['type']=='student')
  94.  
  95. {
  96.  
  97. header("Location: student.html");
  98. }
  99. elseif($row['username']==$username && $row['password']==$password && row['type']=='teacher')
  100.  
  101. {
  102.  
  103. header("Location: teacher.html");
  104. }
  105. }
  106. }
  107.  
  108. ?>
Add Comment
Please, Sign In to add comment