예제 #1
0
파일: index.php 프로젝트: Rayac/PDOtest
$image = new Image($pdo);
$errors = [];
$message = "";
if (isset($_GET['logout'])) {
    $user->logout();
}
if ($user->isloggedin()) {
    if (isset($_POST['action'])) {
        if ($_POST['action'] == "upload") {
            if ($_FILES['uploadImg']['tmp_name']) {
                $ext = pathinfo($_FILES['uploadImg']['name']);
                if ($ext['extension'] == "jpg" || $ext['extension'] == "jpeg" || $ext['extension'] == "png" || $ext['extension'] == "PNG" || $ext['extension'] == "JPEG" || $ext['extension'] == "JPG") {
                    $imgName = $_FILES['uploadImg']['name'];
                    $imglocation = 'pics/' . md5(time() . $imgName) . "." . $ext['extension'];
                    if (is_uploaded_file($_FILES['uploadImg']['tmp_name'])) {
                        echo $image->uploadImage($user->getId(), $_FILES['uploadImg']);
                    }
                } else {
                    $errors[] = "Images only!" . " " . $ext['extension'];
                }
            }
        }
    }
}
if (isset($_POST['add'])) {
    $user->addClick($_POST['add']);
}
if (isset($_POST['rEmail'])) {
    try {
        $email = new vo\Email($_POST['rEmail']);
    } catch (Exception $e) {