Guest User

Untitled

a guest
Mar 19th, 2019
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <type="text/javascript"></script>
  6. <script type="text/javascript" src="jquery.js"></script>
  7. <link rel="stylesheet" href="styles.css" type="text/css" />
  8. <title>Login Form</title>
  9. <script type="text/javascript">
  10. $(document).ready(function(){
  11. $("#login").click(function(){
  12. username=$("#user_name").val();
  13. password=$("#password").val();
  14.  
  15. $.ajax({
  16. type : "POST",
  17. url : "login.php",
  18. data : "username="+username+"&password="+password,
  19. success : function(html){
  20. if(html=='true'){
  21. $("#add_err").html("right username And password");
  22. //$("#login_form").fadeOut("normal");
  23. //$("#shadow").fadeOut();
  24. //$("#profile").html("<a href='logout.php' class='red' id='logout'>Logout</a>");
  25. }else{
  26. $("#add_err").html("Wrong username And password");
  27. }
  28. },
  29. beforeSend:function(){
  30. $("#add_err").html("Loading...")
  31. }
  32. });
  33. return false;
  34. });
  35. });
  36. </script>
  37. </head>
  38. <body>
  39. <?php session_start(); ?>
  40. <div id="profile">
  41. <?php if(isset($_SESSION['user_name'])){ ?>
  42.  
  43. <?php } ?>
  44. </div>
  45. </body>
  46.  
  47. <?php if(empty($_SESSION['user_name'])){ ?>
  48. <div class="container" id="login_form">
  49. <section id="content">
  50. <form action="login.php">
  51. <h1>Login Form</h1>
  52. <div>
  53. <input type="text" placeholder="Username" required="" id="user_name" name="user_name"/>
  54. </div>
  55. <div>
  56. <input type="password" placeholder="Password" required="" id="password" name="password"/>
  57. </div>
  58. <div class="err" id="add_err"></div>
  59. <div>
  60. <input type="submit" value="Log in" id="login" />
  61. </div>
  62. </form>
  63. <div class="button"> </div>
  64. </section>
  65. </div>
  66. <?php } ?>
  67.  
  68. </html>
Add Comment
Please, Sign In to add comment