예제 #1
0
파일: UserTest.php 프로젝트: Rayac/PDOtest
 /**
  * @dataProvider usersProvider
  */
 public function testRegister($email, $username, $pass)
 {
     $user = new User(self::$pdo);
     $user->register($email, $pass, $username);
     $user->setEmail($email);
     $this->assertEquals($email, $user->getEmail());
     $this->assertEquals($username, $user->getUsername());
 }
예제 #2
0
파일: index.php 프로젝트: Rayac/PDOtest
    $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()]);
            exit;
        } else {