Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('header.php');
- require_once ('datasets/Login2.php');
- require_once ('datasets/UserDataSet.php');
- require_once ('classes/User.php');
- $view = new stdClass();
- $view->pageTitle = 'login';
- $userDataSet = new UserDataSet();
- //$inputEmail= $_POST['inputEmail'];
- //$inputPassword = $_POST['inputPassword'];
- if (isset($_POST['login'])) {
- $user= new UserDataSet();
- // store login input in vairable
- // store password after encrypting using md5
- $email = $_POST['email'];
- $ePassword = $_POST['password'];
- // call check email.
- $result = $userDataSet->checkEmail($email);
- if ($result == false){
- // if false, the email doesn't exist in the db
- echo 'Email or Password is incorrect';
- } else if ($result == true)
- {
- // else, call check password
- if ($userDataSet->checkPassword($email, $ePassword) == false){
- //incorrect password
- echo 'Email or Password is incorrect';
- } else {
- //log in
- echo 'You are logged in.';
- //makes user object, serializes to avoid enctype disruption
- $userInfo = new user($userDataSet->retrieveUserDetails($email));
- $_SESSION['user']=true;
- $_SESSION['userInfo'] = base64_encode(serialize($userInfo));// object to string
- //echo base64_encode(serialize($userInfo));
- echo $_SESSION['userInfo'];
- $test = $_POST['email'];
- }
- }
- }
- require_once("views/login.phtml");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement