Guest User

Untitled

a guest
Apr 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <?php
  2. session_start();//session starts here
  3. ?>
  4.  
  5. <?php
  6. error_reporting(E_ALL);
  7. ini_set("display_errors", 1);
  8.  
  9. include("connection.php");
  10.  
  11. if(isset($_POST['submit']))
  12. {
  13. $Mobile=$_POST['Mobile'];
  14. $Password=$_POST['Password'];
  15.  
  16. $check_user="select * from
  17. UserRegLogs WHERE Mobile='$Mobile' AND Password='$Password'";
  18.  
  19. $run=mysqli_query($dbcon,$check_user);
  20.  
  21. if(mysqli_num_rows($run))
  22. {
  23. echo "<script>window.open('mypage.php','_self'). </script>";
  24.  
  25. $_SESSION['Mobile']=$Mobile;//here session is used and value of $Mobile store in $_SESSION.
  26.  
  27. }
  28. else
  29. {
  30. echo "<script>alert('Email or password is incorrect!').
  31. </script>";
  32. }
  33. }
  34. ?>
  35.  
  36. <?php
  37. session_start();
  38. if(!$_SESSION['Mobile'])
  39. {
  40.  
  41. header("Location: login.php");//redirect to login page to secure the welcome page without login access.
  42. }
  43.  
  44. ?>
  45.  
  46. <html>
  47. <head>
  48. <title>Registration</title>
  49. </head>
  50.  
  51. <body>
  52. <h1>Welcome</h1><br>
  53. <?php
  54. echo $_SESSION['Mobile'];
  55. ?>
  56.  
  57.  
  58. <h1><a href="logout.php">Logout here</a> </h1>
Add Comment
Please, Sign In to add comment