Guest User

Untitled

a guest
Oct 11th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. <?php
  2.  
  3. session_start();
  4.  
  5. ?>
  6. <fieldset>
  7. <legend>LOG IN</legend>
  8. <form id="login" name="login" method="POST" action="index.php?pagina=login">
  9. Username:<input type="text" name="username"/><br />
  10. Password:<input type="password" name="password"/>
  11. <input type="submit" name="submit" />
  12. </form>
  13. </fieldset>
  14.  
  15. <?php
  16. //include Connect
  17. include 'connect.php';
  18.  
  19. //variabelen
  20. $submit = ($_POST['submit']);
  21. $username = ($_POST['username']);
  22. $password = md5($_POST['password']);
  23.  
  24.  
  25. //LOGIN
  26. if ($username&&$password)
  27. {
  28. $sql_query = mysql_query ("SELECT * FROM user WHERE username='$username'");
  29. $numrow = mysql_num_rows($sql_query);
  30.  
  31. if($numrow!=0)
  32. {
  33. while($row = mysql_fetch_array($sql_query))
  34. {
  35. $dbusername = $row['username'];
  36. $dbpassword = $row['password'];
  37.  
  38. //check to see if they match
  39. if($username==$dbusername&&$password==$dbpassword)
  40. {
  41. //login succes, SESSIED AANMAKEN
  42. $_SESSION['recht']=$row['recht'];
  43. $_SESSION['user_id']=$row['user_id'];
  44.  
  45.  
  46. if($_SESSION['recht']==1)
  47. {
  48. header("Location: index.php?pagina=admin");
  49. }
  50. if($_SESSION['recht']==2)
  51. {
  52. header("Location: index.php?pagina=medewerker");
  53. }
  54. if($_SESSION['recht']==3)
  55. {
  56. header("Location: index.php?pagina=klant");
  57. }
  58. }
  59. else
  60. {
  61. die ("De gegevens Kloppen niet");
  62. }
  63. }
  64. }
  65. else die ("Deze gebruiker is niet aanwezig in onze Database");
  66. }
  67.  
  68. ?>
Add Comment
Please, Sign In to add comment