Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- $ini = parse_ini_file('../../app.ini');
- $app_url = $ini['app_url'];
- $db_cred = parse_ini_file('../../db.ini');
- include("../model/User.php");
- ?>
- <?php
- if($_POST['email'] != "" && $_POST['password'] != "")
- {
- $email = $_POST['email'];
- $password = $_POST['password'];
- try
- {
- $pdo = new PDO('mysql:host='.$db_cred['host'].';dbname='.$db_cred['db_name'], $db_cred['db_user'], $db_cred['db_pw']);
- }catch(PDOException $e)
- {
- echo $e->getMessage();
- }
- $user = new User($pdo, $email, $password);
- if ($user_id = $user->login())
- {
- header("Location: ".$app_url);
- }
- else
- {
- echo "doesn't work: ".$user_id." + e-mail:".$email."<br>object: ".var_dump($user);
- header("Location: ".$app_url."view/login.php?errorLogin=1");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement