Advertisement
Guest User

Untitled

a guest
Aug 31st, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. require('db_con.php');
  2.  
  3.  
  4. if (isset($_POST['user_name'])and isset($_POST['user_password']))
  5. {
  6. $username=$_POST['user_name'];
  7. $password=$_POST['user_password'];
  8.  
  9. $query="select * from `users` where `user_name`='".$username."' and user_password ='".$password."'";
  10. $result=mysqli_query($con, $query) or die(mysqli_error($con));
  11. $count=mysqli_num_rows($result);
  12.  
  13. if($count==1){
  14. $_SESSION['user_name']=$username;
  15. }
  16. else
  17. {
  18. $fmsg="Invalid Login Credentials.";
  19. }
  20. }
  21.  
  22. if(isset($_SESION['user_name']))
  23. {
  24. $username=$_SESSION['user_name'];
  25. echo"Hello" .$username ."";
  26.  
  27. }
  28.  
  29.  
  30. ?>
  31. <html>
  32. <head>
  33. <title>Login</title>
  34. </head>
  35. <body>
  36. <h1></h1>
  37. <form action="" method="post">
  38. <label>User Name :</label>
  39. <input type="text" name="user_name" /><br />
  40. <label>Password</label>
  41. <input type="password" name="user_password" /><br />
  42. <input type="submit" value="Login" name="submit"/>
  43. </form>
  44. <?php
  45.  
  46. ?>
  47. </body>
  48. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement