Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require("connect_db.php");
- $username=$_POST['username'];
- $password=($_POST['password']);
- $check=$_POST['remember'];
- $res=mysql_query("SELECT * FROM tb_user_info");
- while($row=mysql_fetch_array($res))
- {
- if($row['Username']==$username)
- {
- $salt = $row['Salt'];
- $cost = 11;
- $params = '$2y$' . ($cost < 10 ? 0 : '') . $cost . "$" . $salt;
- echo "<pre>";
- echo "Input: $password";
- echo "Salt: $salt";
- $password = crypt($password, $params);
- echo "Result: $password";
- $val = $row['Password'];
- echo "DB: $val";
- echo "</pre>";
- exit;
- if($row['Password']==$password)
- {
- $_SESSION['username']=$username;
- if($check=='1')
- {
- $keep=$check;
- setcookie("keepme",$keep,time()+3600*24*15);
- setcookie("keepuser",$username,time()+3600*24*15);
- }
- if($username=="admin")
- header("Location: home_admin.php");
- else
- header("Location: home.php");
- exit;
- }
- else
- {
- header("Location: index.php?wrong=2");
- exit;
- }
- }
- }
- session_destroy();
- header("Location: index.php?wrong=1");
- exit;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement