Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require 'includes/database.php';
- ?>
- <!doctype html>
- <html lang="en">
- <head>
- <title>PDF Mailer</title>
- <link href="css/style.css" rel="stylesheet" />
- </head>
- <body>
- <div id="wrapper">
- <?php
- if(isset($_SESSION['loggedin'])) {
- echo '<div id="loggedin">';
- echo "<span>Du är inloggad som <b>".ucwords($_SESSION['loggedin'])."</b> | </span>";
- echo '<a href="logout.php">Logga ut</a>';
- echo '</div>';
- } else {
- echo '
- <form action="#" method="post">
- <h2>Logga in</h2>
- <label for="username">Användarnamn:</label><br />
- <input type="text" name="username" id="username" /><br />
- <label for="password">Lösenord:</label><br />
- <input type="password" name="password" id="password" /><br />
- <input type="submit" name="submit" value="Logga in" /><br />
- </form>
- ';
- }
- if(isset($_POST['submit'])) {
- $username = $_POST['username'];
- $password = mysql_real_escape_string($_POST['password']);
- if(!$username | !$password) {
- echo "<p>Fält är tomma!</p>"; // Kollar om fälten är ifyllda!
- }else {
- $check = mysql_query("SELECT username FROM member WHERE username = '$username' and password = '$password' ");
- $check2 = mysql_num_rows($check);
- if($check2 == 0) { die('<p>Användaren finns inte!</p>');
- } else {
- echo 'Hello';
- $_SESSION['loggedin'] = $username;
- header('Location: index.php');
- }
- }
- }
- if(isset($_SESSION['loggedin'])) {
- include 'includes/create_doc.php';
- } else { echo ''; }
- ?>
- </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment