Esempio n. 1
0
<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>
Esempio n. 2
0
<?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">
Esempio n. 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>
Esempio n. 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']);