Advertisement
Guest User

Untitled

a guest
Mar 4th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.87 KB | None | 0 0
  1. <?php
  2. session_start();
  3. include_once 'dbconnect.php';
  4.  
  5. if(isset($_SESSION['user'])!="")
  6. {
  7. $_SESSION['userId'] = $_POST['Username'];
  8. header("Location: account.php");
  9. }
  10. if(isset($_POST['btn-login']))
  11. {
  12. $uname = mysql_real_escape_string($_POST['Username']);
  13. $upass = $_POST['Password'];
  14.  
  15. $uname = trim($uname);
  16. $upass = trim($upass);
  17.  
  18. $res=mysql_query("SELECT userId, username, password FROM users WHERE username='$uname'");
  19. $row=mysql_fetch_array($res);
  20.  
  21. $count = mysql_num_rows($res); // if uname/pass correct it returns must be 1 row
  22.  
  23. if($count == 1 && $row['password']==$upass)
  24. {
  25. $_SESSION['user'] = $row['userId'];
  26. header("Location: account.php");
  27. }
  28. else
  29. {
  30. ?>
  31. <script>alert('Username / Password Seems Wrong !');</script>
  32. <?php
  33. }
  34.  
  35. }
  36. ?>
  37.  
  38. <!DOCTYPE html>
  39. <html lang="en">
  40. <head>
  41. <meta charset="utf-8">
  42. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  43. <meta name="description" content="Team 12, Code App, Level Up, Travel, Agency">
  44.  
  45. <title>Login</title>
  46.  
  47. <!-- Bootstrap core CSS -->
  48. <link href="css/bootstrap_nova.css" rel="stylesheet">
  49. <!--external css-->
  50. <link href="css/font-awesome/css/font-awesome.css" rel="stylesheet" />
  51.  
  52. <!-- Custom styles for this template -->
  53. <link href="css/style.css" rel="stylesheet">
  54. <link href="css/style-responsive.css" rel="stylesheet">
  55. <style>
  56. #test1{
  57. opacity: 0.9;
  58. }
  59. </style>
  60. </head>
  61.  
  62. <body>
  63. <div id="login-page">
  64. <div class="container">
  65.  
  66. <form class="form-login" method="post" id="test1">
  67. <h2 class="form-login-heading">sign in now</h2>
  68. <div class="login-wrap">
  69. <div class="input-group input-group-lg">
  70. <span style="border: none" class="input-group-addon"><i style="width: 15px; border:none;" class="fa fa-user"></i></span>
  71. <input type="text" class="form-control" placeholder="Username" name="Username" style="border: none" autofocus required>
  72. </div>
  73. <br>
  74. <div class="input-group input-group-lg">
  75. <span style="border: none" class="input-group-addon"><i style="width: 15px;" class="fa fa-lock"></i></span>
  76. <input type="password" class="form-control" placeholder="Password" name="Password" style="border: none" required>
  77. </div>
  78.  
  79. <label class="checkbox">
  80. <span class="pull-right">
  81. <a data-toggle="modal" href="login.php#myModal"> Forgot Password?</a>
  82.  
  83. </span>
  84. </label>
  85.  
  86. <button class="btn btn-theme btn-block" name="btn-login" type="submit"><i class="fa fa-lock"></i> SIGN IN</button>
  87. <hr>
  88.  
  89. <div class="registration">
  90.  
  91. <strong><a class="" href="register.php">
  92. Create an account
  93. </a></strong>
  94. |
  95.  
  96. <strong> <a class="" href="index.php">
  97. Home
  98. </a></strong>
  99. |
  100. <strong><a class="" href="blog.php">
  101. Blog
  102. </a></strong>
  103.  
  104. </div>
  105.  
  106. </div>
  107. </form>
  108.  
  109. </div>
  110. </div>
  111.  
  112. <!-- js placed at the end of the document so the pages load faster -->
  113. <script src="js/jquery.js"></script>
  114. <script src="js/bootstrap.min.js"></script>
  115.  
  116. <!--BACKSTRETCH-->
  117. <!-- You can use an image of whatever size. This script will stretch to fit in any screen size.-->
  118. <script type="text/javascript" src="js/jquery.backstretch.min.js"></script>
  119. <script>
  120. $.backstretch("img/paris-large.jpeg", {speed: 500});
  121.  
  122. </script>
  123.  
  124.  
  125. </body>
  126. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement