diff --git a/login.php b/login.php index cb19a3b..b7b742f 100644 --- a/login.php +++ b/login.php @@ -2,36 +2,26 @@ require('db.php'); session_start(); // If form submitted, insert values into the database. -if (isset($_POST['username'])){ - // removes backslashes +if (isset($_POST['username'])) { + // removes backslashes $username = stripslashes($_REQUEST['username']); - //escapes special characters in a string + //escapes special characters in a string $username = mysqli_real_escape_string($con,$username); $password = stripslashes($_REQUEST['password']); $password = mysqli_real_escape_string($con,$password); //Checking is user existing in the database or not - $query = "SELECT * FROM `users` WHERE username='$username' -and password='".md5($password)."'"; + $query = "SELECT * FROM `users` WHERE username='$username' + and password='".md5($password)."'"; $result = mysqli_query($con,$query) or die(mysql_error()); $rows = mysqli_num_rows($result); - if($rows==1){ + if ($rows==1) { $_SESSION['username'] = $username; - // Redirect user to index.php + // Redirect user to home.php header("Location: home.php"); - }else{ - echo "
-

Username/password is incorrect.

-
Click here to Login
"; + } else { + echo "
+

Username/password is incorrect.

+
Click here to Login
"; } - }else{ +} ?> -
-

Log In

-
- - - -
-

Not registered yet? Register Here

-
-