PhotoShare/controllers/signin.php
Muhammad Anas Rashid 34753111ed My First Web application .. a real shitty one
My First Web application .. a real shitty one
2016-01-28 23:32:09 +05:00

34 lines
628 B
PHP

<?php
session_start();
require_once("../models/user.php");
if(isset($_POST['login']))
{
$pass=$_POST['pass'];
$username=$_POST['username'];
if(empty($username)||empty($pass))
{
$error = "Please Enter both Username and Password!";
}
else
{
if(user::validate($username,$pass)==true)
{
$myuser= new User($username);
$_SESSION["user"] =$myuser->get_values();
var_dump($_SESSION["user"]);
header("Location: ../views/profilePage.php?username=".$username);
}
else
{
$error="Incorrect Username or Password!";
}
}
}
else
{
$error = "Press 'Login' to enter.";
}
?>