Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1.  
  2. <?php include("header.php");
  3. if(!empty($_SESSION['name']))
  4. {
  5. header("location: index.php");
  6. }
  7. session_destroy();
  8. session_start();
  9.  
  10. if(!empty($_POST['submit']))
  11. {
  12. if(!empty($_POST['naam']) && !empty($_POST['wachtwoord']))
  13. {
  14. $results = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE name = '".$_POST['naam']."'"));
  15. if($results['name']!="")
  16. {
  17. if($results['pass']==md5($_POST['wachtwoord']))
  18. {
  19. $_SESSION['id'] = $results['id'];
  20. $_SESSION['name'] = $results['name'];
  21. $_SESSION['pass'] = $results['pass'];
  22. header("location: index.php");
  23. }
  24. else $fout = "Wachtwoord is foutief.";
  25. }
  26. else $fout = "Naam bestaat niet.";
  27. }
  28. else $fout = "je hebt niet alles ingevuld!";
  29. }
  30.  
  31. ?>
  32. <form method="post" action="login.php">
  33. <table cellspacing="1" width="850px" id="inhoud_table">
  34. <tr><th colspan="2">Inloggen</th></tr>
  35. <?php if(!empty($fout)) Echo "<tr><td colspan=\"2\" class=\"table_register_fail\">".$fout."</td></tr>"; ?>
  36. <tr><td class="table_category"><b>Gebruikersnaam:</b></td><td class="table_register"><input type="text" name="naam" size="30" maxlength="40" ></td></tr>
  37. <tr><td class="table_category"><b>Wachtwoord:</b></td><td class="table_register"><input type="password" name="wachtwoord" size="30" maxlength="40" ></td></tr>
  38. <tr><td class="table_category" colspan="2"><center><INPUT TYPE="submit" name="submit" VALUE="&nbsp;Inloggen&nbsp;"></center></td></tr>
  39. </table>
  40. </form>
  41. <?php include("footer.html"); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement