Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. <? session_start(); ?>
  2. <div align="left"><a href='register.php'>REGISTER&nbsp; <i class="fa fa- user-plus" aria-hidden="true"></i></a>
  3. <? include('HtmlNavSetupnohome.php');include('sqlDeets.php')
  4. ?>
  5. <link href="css/hawthorne_type1_color1.css" rel="stylesheet">
  6. <link href="css/font-awesome.min.css" rel="stylesheet">
  7.  
  8. <form action="" method="POST">
  9. <h3>USERNAME:</h3><input id="username" type="text" name="username"/>
  10. <h3>PASSWORD:</h3><input id="password" type="password" name="password"/><br>
  11. <input class="login" type="submit" name="submit" value="Login" />
  12. </form>
  13.  
  14. <?
  15. include('connect.php');
  16. if (isset($_POST['username']) and isset($_POST['password'])){
  17. $username = $_POST['username'];
  18. $password = $_POST['password'];
  19. $query = "SELECT * FROM user WHERE username='$username' and password='$password'";
  20. $result = mysql_query($query) or die(mysql_error());
  21. $count = mysql_num_rows($result);
  22.  
  23. if (isset($_POST['submit']))
  24.  
  25. {
  26.  
  27. if ($count == 1){
  28. $_SESSION['username'] = $username;
  29. }else{
  30.  
  31. ?>
  32.  
  33.  
  34. <br>INVALID LOGIN DETAILS<br><?
  35. session_destroy();
  36. $_SESSION['username'] = null;
  37. }
  38.  
  39. }
  40.  
  41. if (isset($_SESSION['username'])){
  42. ?>
  43. <script type="text/javascript">location.href = 'http://www.bradleyboothman.co/homepage.php';</script>
  44. <?
  45. $_SESSION['username'] = $username;
  46. }else{
  47.  
  48. }
  49.  
  50. }
  51.  
  52. if (!isset($_SESSION['username'])) {
  53. // use is not logged in
  54. } else {
  55. // user is logged in
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement