Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require_once('class.php');
- if (isset($_POST['submit'])){
- if (empty($_POST['username']) || empty($_POST['password'])){
- echo "<p style='color:red'>Fill both fields</p>";
- }
- else{
- $user = new User();
- $username = $user->escapeInput($_POST['username']);
- $password = sha1($user->escapeInput($_POST['password']));
- if ($user->authenticate($username,$password)){
- $_SESSION['user'] = $username;
- header("Location:homepage.php");
- }
- else{
- echo "<p style='color:red'>Incorrect login details</p>";
- }
- }
- }
Add Comment
Please, Sign In to add comment