예제 #1
0
파일: UserTest.php 프로젝트: Rayac/PDOtest
 public static function tearDownAfterClass()
 {
     $user = new User(self::$pdo);
     foreach (self::$users as $key => $value) {
         $user->setEmail($value[0]);
         $result = $user->delete();
         if (!$result) {
             throw new \Exception('Could not delete user : '******'"' . $value[1] . '"');
         }
     }
 }
예제 #2
0
파일: index.php 프로젝트: Rayac/PDOtest
}
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()]);
            exit;
        } else {
            $errors[] = "Email and password don't match";
            echo $twig->render("form.twig", ['errors' => $errors, 'message' => $message]);
            exit;
        }
    } else {
        $errors[] = "Invalid email";
    }
}
echo $twig->render("form.twig", ['errors' => $errors, 'message' => $message]);
/*
		SCRAPYARD