예제 #1
0
파일: index.php 프로젝트: Rayac/PDOtest
}
if (isset($_GET["success"])) {
    $message = "Registration complete!";
}
if (isset($_GET["deleted"])) {
    $message = "Account deleted!";
}
if (isset($_GET["logout"])) {
    $message = "Logged out!";
}
if (isset($_GET['register'])) {
    echo $twig->render("reg.twig");
    exit;
}
if (isset($_SESSION['email']) & isset($_SESSION['pass'])) {
    if ($user->loginRequest($_SESSION['email'], $_SESSION['pass'])) {
        $image->findImageByUserID($user->getId());
        echo $twig->render("click.twig", ['username' => $user->getUsername(), 'errors' => $errors, 'imageURL' => $image->getImageURL(), 'clickCount' => $user->getClickCount()]);
        exit;
    }
}
if (isset($_POST['email']) & isset($_POST['pass'])) {
    if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
        $gotEmail = $_POST['email'];
        $gotPass = $_POST['pass'];
        if ($user->loginRequest($gotEmail, $gotPass)) {
            $_SESSION['email'] = $gotEmail;
            $_SESSION['pass'] = $gotPass;
            $user->setEmail($gotEmail);
            $image->findImageByUserID($user->getId());
            echo $twig->render("click.twig", ['username' => $user->getUsername(), 'errors' => $errors, 'imageURL' => $image->getImageURL(), 'clickCount' => $user->getClickCount()]);