示例#1
0
文件: index.php 项目: Nargal/schef.se
<link rel="stylesheet" type="text/css" href="forum/inc/style/schef.se_forum_v0.1.css">

<section>
    <?php 
$auth = new EAuth($mysqli);
if (!$auth->isLogged($mysqli)) {
    echo 'Du måste vara inloggad för att komma åt forumet.';
} else {
    ?>
    
    <div class="forumContainer"></div>
    <div class="forumContainer"></div>
    <div class="forumContainer"></div>
    
    <?php 
}
?>
</section>
示例#2
0
文件: login.php 项目: Nargal/schef.se
<?php

$auth = new EAuth($mysqli);
if ($auth->isLogged($mysqli)) {
    header('Location: http://localhost');
}
if (isset($_POST['username']) && isset($_POST['password'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $remember = $_POST['remember'];
    $login = $auth->login($username, $password, $remember);
    if (!$login['error']) {
        setcookie(COOKIE_EAUTH, $login['hash'], $login['expire'], '/');
        header('Location: ' . $_SERVER['HTTP_REFERER']);
    } else {
        $error = $login['message'];
    }
}
?>

<section>
    <div id="login">
        <h2>Logga in</h2>
        <div><?php 
echo $error;
?>
</div>
        <form method="POST">
            <input type="text" name="username" placeholder="Användarnamn eller e-post">
            <input type="password" name="password" placeholder="Lösenord">
            <input type="submit" value="Logga in">
示例#3
0
<?php

$auth = new EAuth($mysqli);
if ($auth->isLogged($mysqli)) {
    header('Location: http://localhost');
}
if (isset($_POST['username']) && isset($_POST['password'])) {
    $username = $_POST['username'];
    $email = $_POST['email'];
    $password = $_POST['password'];
    $confirmPassword = $_POST['confirmPassword'];
    $register = $auth->register($username, $email, $password, $confirmPassword);
    $message = $register['message'];
}
?>

<section>
    <div id="register">
        <h2>Bli medlem</h2>
        <div><?php 
echo $message;
?>
</div>
        <form method="POST">
            <input type="text" name="username" placeholder="Användarnamn">
            <input type="text" name="email" placeholder="E-post">
            <input type="password" name="password" placeholder="Lösenord">
            <input type="password" name="confirmPassword" placeholder="Bekräfta lösenord">
            <input type="submit" value="Registrera dig">
        </form>
    </div>
示例#4
0
<?php

$auth = new EAuth($mysqli);
$auth->logout($_COOKIE[COOKIE_EAUTH]);
unset($_COOKIE[COOKIE_EAUTH]);
setcookie(COOKIE_EAUTH, null, -1, '/');
header('Location: ' . $_SERVER['HTTP_REFERER']);