Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("../includes/init.php");
- $message = "";
- $message2 = "";
- $Salt = uniqid();
- $Algo = '6';
- $Rounds = '5000';
- $CryptSalt = '$' . $Algo . '$rounds=' . $Rounds . '$' . $Salt;
- if (isset($_POST['submit'])) { // Form is submitted.
- $username = trim($_POST['username']);
- $password = crypt($_POST['password'], $CryptSalt);
- // Check database to see if user/pass exists.
- $stmt = $db->prepare("SELECT username, password FROM xail_users WHERE username = :username AND password = :password");
- $stmt->bindParam(':username', $username);
- $stmt->bindParam(':password', crypt($password, $CryptSalt));
- $stmt->execute();
- if($stmt->rowCount() > 0 )
- {
- $_SESSION['username'] = $username;
- redirect_to("index.php");
- } else {
- $message = "Username or password is incorrect!";
- }
- } else { // Form not submitted.
- $username = "";
- $password = "";
- }
Add Comment
Please, Sign In to add comment