Advertisement
Guest User

seh

a guest
Jul 18th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2.  
  3. use classes\system as system;
  4.  
  5. class login {
  6.  
  7. public function __construct() {
  8.  
  9. }
  10.  
  11. public function login() {
  12.  
  13. if(isset($_POST['submit'])) {
  14.  
  15. if(empty($_POST['password']) && empty($_POST['password'])) {
  16.  
  17. echo "Je bent iets vergeten om in te vullen!";
  18.  
  19. } else {
  20.  
  21. $username = $_POST['username'];
  22. $password = $_POST['password'];
  23.  
  24. $data = system::db()->queryFirstRow("SELECT username FROM users WHERE username=%s, $username");
  25.  
  26. if(system::db()->count() > 0) {
  27.  
  28. if($data['password'] == sha1(md5($password))) {
  29.  
  30. $_SESSION['login'] = true;
  31. $_SESSION['username'] = $username;
  32. $_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
  33.  
  34. $ip = $_SESSION['ip'];
  35.  
  36. $iplog = system::db()->update('users', array( 'ip_last'=> $ip));
  37.  
  38. }
  39. }
  40.  
  41.  
  42. }
  43. }
  44. }
  45.  
  46. if($_SESSION['login'] = true) {
  47.  
  48. header("Location: home.php");
  49.  
  50.  
  51. }
  52. }
  53.  
  54.  
  55. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement