Guest User

Session Destroys On Page Refresh

a guest
Jun 24th, 2017
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include("../config.php");
  4. error_reporting(E_ALL ^ E_NOTICE);
  5.  
  6. if(isset($_POST['login']))
  7. {
  8.     $user=mysqli_real_escape_string($con,$_POST['username']);
  9.     $pass=mysqli_real_escape_string($con,$_POST['password']);
  10.     $enc_pass=md5($pass);
  11.    
  12.     $get_detail=mysqli_query($con,"SELECT * FROM `users` WHERE email='$user' AND password='$enc_pass' ");
  13.     $check=mysqli_num_rows($get_detail);
  14.    
  15.     if($check>0)
  16.     {
  17.         $_SESSION['email']=$user;
  18.         echo"<script>window.open('dashboard.php','_SELF')</script>";
  19.     }
  20.    
  21.         else
  22.     {
  23. echo "Invalid Details";
  24.  
  25. }
Add Comment
Please, Sign In to add comment