Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <link rel="stylesheet" type="text/css" href="style.css">
- <link rel="icon" href="favicon.ico" type="image/x-icon"/>
- <title>Age Of Thronez</title>
- </head>
- <body>
- <div class="content">
- <img src="http://i.imgur.com/K58RtVF.png" style="
- width: 300px;
- margin-bottom: 2em;
- margin-top: 2em;
- ">
- <?php
- require('db.php');
- session_start();
- // If form submitted, insert values into the database.
- if (isset($_POST['username'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- $username = stripslashes($username);
- $username = mysql_real_escape_string($username);
- $password = stripslashes($password);
- $password = mysql_real_escape_string($password);
- //Checking is user existing in the database or not
- $query = "SELECT * FROM `users` WHERE username='$username' and password='".md5($password)."'";
- $result = mysql_query($query) or die(mysql_error());
- $rows = mysql_num_rows($result);
- if($rows==1){
- $_SESSION['username'] = $username;
- header("Location: index.php"); // Redirect user to index.php
- }else{
- echo "<div class='form'><h3>Username/password is incorrect.</h3><br/>Click here to <a href='login.php'>Login</a></div>";
- }
- }else{
- ?>
- <br>
- <form action="index.php" method="post" name="login">
- <input type="text" name="username" placeholder="Brukernavn" required></input><br>
- <input type="password" name="password" placeholder="Passord" required></input><br>
- <input name="submit" type="submit" value="Login" />
- </form>
- <br>
- <a id="knapp" href="reg.php">Registrer deg</a>
- <?php } ?>
- </div>
- <div id="footer">
- Copyright © 2016 Age Of Thronez © All rights reserved<br>
- <a href="vilkar.php">Vilkår og betingelser</b>
- </div>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement