Hello,
I am wanting to encrypt my password that is submitted in the login form with sha512 and salt, is this correct as at the moment when i enter the incorrect information and submit it just loads a blank page which I’m assuming there is something wrong with my code.
[php]
<?php session_start(); // Starting Session $error=''; // Variable To Store Error Message if (isset($_POST['submit'])) { if (empty($_POST['email']) || empty($_POST['password'])) { $error = "Email or Password is invalid"; } else { // Define $email and $password $username=$_POST['email']; $password=$_POST['password']; $salt = "/GTyod58&aw|+fjv93%~\RFewo23fhe^"; $encryptpass=sha512($salt.$password); // To protect MySQL injection for Security purpose $email = stripslashes($email); $password = stripslashes($password); $email = mysql_real_escape_string($email); $password = mysql_real_escape_string($password); // Establishing Connection with Server by passing server_name, user_id and password as a parameter $connection = mysql_connect("localhost", "user", "pass"); // Selecting Database $db = mysql_select_db("database", $connection); // SQL query to fetch information of registerd users and finds user match. $query = mysql_query("select * from adminlogin where password='$encryptpass' AND email='$email'", $connection); $rows = mysql_num_rows($query); if ($rows == 1) { $_SESSION['email']=$email; // Initializing Session header("location: test.com/profile.php"); // Redirecting To Other Page } else { $error = "Email or Password is invalid"; } mysql_close($connection); // Closing Connection } } ?>[/php]