Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if (isset($_SESSION['user'])){
- header("Location: home.php");
- }
- if (isset($_POST['login'])){
- $user = $_POST['username'];
- $password = $_POST['password'];
- if ($user == "samad" && $password == "root"){
- $_SESSION['user'] = $user;
- echo '<script type="text/javascript"> window.open("home.php","_self");</script>';
- } else {
- echo "failed to login";
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- </head>
- <body>
- <style>
- .form{
- width: 600px;
- }
- input[type=submit] {
- width: 100%;
- background-color: #4CAF50;
- color: white;
- padding: 14px 20px;
- margin: 8px 0;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- }
- input[type=submit]:hover {
- background-color: #45a049;
- }
- div {
- border-radius: 5px;
- background-color: #f2f2f2;
- padding: 20px;
- }
- </style>
- <div class="form">
- <h1>Vänligen logga in</h1>
- <form action="home.php">
- <label for="fname">Your Name</label>
- <input type="text" id="fname" name="firstname" placeholder="Your name..">
- <label for="lname">Your Password</label>
- <input type="password" id="lname" name="lastname" placeholder="Your password..">
- <input type="submit" value="Submit">
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement