Advertisement
Guest User

Untitled

a guest
Apr 7th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  4. <link rel="stylesheet" type="text/css" href="style.css">
  5. <link rel="icon" href="favicon.ico" type="image/x-icon"/>
  6. <title>Age Of Thronez</title>
  7. </head>
  8. <body>
  9. <div class="content">
  10. <img src="http://i.imgur.com/K58RtVF.png" style="
  11. width: 300px;
  12. margin-bottom: 2em;
  13. margin-top: 2em;
  14. ">
  15. <?php
  16. require('db.php');
  17. session_start();
  18. // If form submitted, insert values into the database.
  19. if (isset($_POST['username'])){
  20. $username = $_POST['username'];
  21. $password = $_POST['password'];
  22. $username = stripslashes($username);
  23. $username = mysql_real_escape_string($username);
  24. $password = stripslashes($password);
  25. $password = mysql_real_escape_string($password);
  26. //Checking is user existing in the database or not
  27. $query = "SELECT * FROM `users` WHERE username='$username' and password='".md5($password)."'";
  28. $result = mysql_query($query) or die(mysql_error());
  29. $rows = mysql_num_rows($result);
  30. if($rows==1){
  31. $_SESSION['username'] = $username;
  32. header("Location: index.php"); // Redirect user to index.php
  33. }else{
  34. echo "<div class='form'><h3>Username/password is incorrect.</h3><br/>Click here to <a href='login.php'>Login</a></div>";
  35. }
  36. }else{
  37. ?>
  38. <br>
  39. <form action="index.php" method="post" name="login">
  40. <input type="text" name="username" placeholder="Brukernavn" required></input><br>
  41. <input type="password" name="password" placeholder="Passord" required></input><br>
  42. <input name="submit" type="submit" value="Login" />
  43. </form>
  44. <br>
  45. <a id="knapp" href="reg.php">Registrer deg</a>
  46. <?php } ?>
  47. </div>
  48. <div id="footer">
  49. Copyright &copy; 2016 Age Of Thronez &copy; All rights reserved<br>
  50. <a href="vilkar.php">Vilkår og betingelser</b>
  51. </div>
  52. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement