Location: PHPKode > scripts > PHP Address book > php-address-book_v_1.00_eng/login.php
<?php 
$doc = "login";
include_once 'includes/header.inc.php'; 

//receive form
if(isset($_POST['submit'])){
    $username = $_POST['username'];
    $password = md5($_POST['password']);
    $remember = $_POST['rememberme'];
    
    $query = $database->query("SELECT * FROM `cal_users` WHERE `username` = '$username' AND `password` = '$password'");
    while($row = mysql_fetch_assoc($query)){
        if($remember == "on"){
            ini_set('session.gc_maxlifetime', 31536000);
        }
        
        $_SESSION['userid'] = $row['id'];
        header("location: index.php");
    }
}
?>
    <form class="well form-inline" method="post" action="">
        <input type="text" class="input-small" placeholder="Username" name="username">
        <input type="password" class="input-small" placeholder="Password" name="password">
        <label class="checkbox">
            <input type="checkbox" name="rememberme"> Remember me
        </label>
        <button type="submit" class="btn" name="submit">Sign in</button>
    </form>
<?php include_once 'includes/footer.inc.php'; ?>
Return current item: PHP Address book