Advertisement
Guest User

Untitled

a guest
Nov 25th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. $ini = parse_ini_file('../../app.ini');
  5. $app_url = $ini['app_url'];
  6.  
  7. $db_cred = parse_ini_file('../../db.ini');
  8.  
  9. include("../model/User.php");
  10. ?>
  11.  
  12. <?php
  13.  
  14. if($_POST['email'] != "" && $_POST['password'] != "")
  15. {
  16. $email = $_POST['email'];
  17. $password = $_POST['password'];
  18.  
  19. try
  20. {
  21. $pdo = new PDO('mysql:host='.$db_cred['host'].';dbname='.$db_cred['db_name'], $db_cred['db_user'], $db_cred['db_pw']);
  22. }catch(PDOException $e)
  23. {
  24. echo $e->getMessage();
  25. }
  26.  
  27. $user = new User($pdo, $email, $password);
  28.  
  29. if ($user_id = $user->login())
  30. {
  31. header("Location: ".$app_url);
  32. }
  33. else
  34. {
  35. echo "doesn't work: ".$user_id." + e-mail:".$email."<br>object: ".var_dump($user);
  36. header("Location: ".$app_url."view/login.php?errorLogin=1");
  37. }
  38. }
  39.  
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement