Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset ($_SESSION['user'])!=''){
- header("Location:index.php");}
- error_reporting(0);
- error_reporting(E_ERROR | E_WARNING | E_PARSE);
- include("config.php");
- $email=$_POST['user'];
- $password=$_POST['pass'];
- if(isset($_POST) && $email!='' && $password!=''){
- $sql=$dbh->prepare("SELECT * FROM users WHERE username=?");
- $sql->execute(array($email));
- while($r=$sql->fetch()){
- $p=$r['password'];
- $p_salt=$r['psalt'];
- $id=$r['id'];
- }
- $site_salt="subinsblogsalt";/*Common Salt used for password storing on site. You can't change it. If you want to change it, change it when you register a user.*/
- $salted_hash = hash('sha256',$password.$site_salt.$p_salt);
- if($p==$salted_hash){
- $_SESSION['user']=$id;
- header("Location:index.php");
- }else{
- echo "<script>alert(\"Wrong Username and Password!\");</script>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement