Пример #1
0
<?php

require_once "../../../../include/config.php";
if ($_REQUEST["userId"] && $_REQUEST["userId"] != '') {
    $flag = preg_match("#(=|'|\")#", test_input($_REQUEST["userId"]));
    if (!$flag) {
        $userId = $_REQUEST['userId'];
        //check that data is unique
        if (isExist($userId, 'tblusers')) {
            deleteUser($userId);
            //role title saved successfully;
            successRegisterMessage($successRegisterMessage);
        } else {
            failedRegisterMessage($notExistDataMessage);
        }
    } else {
        failedRegisterMessage($notValidInputMessage);
    }
} else {
    failedRegisterMessage($notValidInputMessage);
}
/**
 * this is so cool to work with Load. :)
 */
Пример #2
0
} catch (PDOException $e) {
    $errors[] = entity_str($e->getMessage());
}
if (!isPost()) {
    include_once '../include/view/login.php';
} else {
    if (getPost('action_id') === 'login') {
        // ユーザIDとパスワードの組み合わせでチェック
        $login_id = entity_str(getPost('login_id'));
        $login_pass = entity_str(getPost('login_pass'));
        //  todo ユーザID入力チェック
        if (!isExist($login_id)) {
            $errors[] = 'ユーザIDを入力してください';
        }
        // todo パスワード入力チェック
        if (!isExist($login_pass)) {
            $errors[] = 'パスワードを入力してください';
        }
        // 入力エラーがない場合DB認証チェック
        if (count($errors) === 0) {
            $login = new user_login_model();
            if ($login->loginCheck($db, $login_id, $login_pass)) {
                // ログインIDを記録
                $_SESSION['login_id'] = $login_id;
                setcookie('login_id', $login_id, time() + 60 * 60 * 24 * 30);
                header('HTTP/1.1 303 See Other');
                header('Location: http://localhost/utwitter/htdocs/main_controller.php');
                exit;
            } else {
                // todo ログイン画面へ。エラーメッセージも表示する。
                $errors[] = 'ユーザIDとパスワードの組み合わせが正しくありません';
Пример #3
0
        $p_StudentID_Exist1 = $SExist1 || $SExist2 || $SExist3;
        $SExist1 = isExist('ID1', 'programmingcontest', $ID2, $p_error);
        $SExist2 = isExist('ID2', 'programmingcontest', $ID2, $p_error);
        $SExist3 = isExist('ID3', 'programmingcontest', $ID2, $p_error);
        $p_StudentID_Exist2 = $SExist1 || $SExist2 || $SExist3;
        $SExist1 = isExist('ID1', 'programmingcontest', $ID3, $p_error);
        $SExist2 = isExist('ID2', 'programmingcontest', $ID3, $p_error);
        $SExist3 = isExist('ID3', 'programmingcontest', $ID3, $p_error);
        $p_StudentID_Exist3 = $SExist1 || $SExist2 || $SExist3;
        // Checking if Email Exist:
        $p_email_err = "This eMail is already registered!";
        $EExist1 = isExist('eMail1', 'programmingcontest', $eMail1, $p_error);
        $EExist2 = isExist('eMail2', 'programmingcontest', $eMail1, $p_error);
        $EExist3 = isExist('eMail3', 'programmingcontest', $eMail1, $p_error);
        $p_Email_Exist1 = $EExist1 || $EExist2 || $EExist3;
        $EExist1 = isExist('eMail1', 'programmingcontest', $eMail2, $p_error);
        $EExist2 = isExist('eMail2', 'programmingcontest', $eMail2, $p_error);
        $EExist3 = isExist('eMail3', 'programmingcontest', $eMail2, $p_error);
        $p_Email_Exist2 = $EExist1 || $EExist2 || $EExist3;
        $EExist1 = isExist('eMail1', 'programmingcontest', $eMail3, $p_error);
        $EExist2 = isExist('eMail2', 'programmingcontest', $eMail3, $p_error);
        $EExist3 = isExist('eMail3', 'programmingcontest', $eMail3, $p_error);
        $p_Email_Exist3 = $EExist1 || $EExist2 || $EExist3;
    }
    if (!$p_missing && !$p_error) {
        $db = new Database();
        $data = array('TeamName' => $TeamName, 'Name1' => $Name1, 'ID1' => $ID1, 'eMail1' => $eMail1, 'Phone1' => $Phone1, 'Name2' => $Name1, 'ID2' => $ID2, 'eMail2' => $eMail2, 'Phone2' => $Phone2, 'Name3' => $Name3, 'ID3' => $ID3, 'eMail3' => $eMail3, 'Phone3' => $Phone3);
        $p_success = $db->insert('programmingcontest', $data);
        $db->close();
    }
}
Пример #4
0
$output = array("msg" => "服务器错误", "result" => false);
if (!isX($user, XUSERNAME)) {
    $output["msg"] = "用户名不合规范";
} else {
    if (!isX($password, XPASSWORD)) {
        $output["msg"] = "密码不合规范";
    } else {
        if (!isX($email, XEMAIL)) {
            $output["msg"] = "邮箱地址不合规范";
        } else {
            if (!checkdnsrr(preg_replace("/^.+\\@([^\\@]+)\$/", '\\1', $email))) {
                $output["msg"] = "邮箱地址无效";
            } else {
                $errmsg = "";
                $e0 = isExist("email", $email, $errmsg);
                $e1 = isExist("username", $user, $errmsg);
                if (!$errmsg) {
                    if ($e0) {
                        $output["msg"] = "邮箱已被使用";
                    } else {
                        if ($e1) {
                            $output["msg"] = "用户名已被注册";
                        } else {
                            $mysqli = getMysqli();
                            $hash = sha1($user . time() . $email . rand(10, 30) + "Ajbo2./OJI");
                            $expire = "NOW() + INTERVAL 1 DAY";
                            $p = $password;
                            $password = password_hash($password, PASSWORD_DEFAULT);
                            trigger_error(password_verify($p, $password) ? "true" : "false");
                            $q = "INSERT INTO nonactivatedUser VALUES ('{$user}', '{$email}', '{$password}', '{$hash}', {$expire}, 'false')";
                            if ($mysqli->query($q)) {
Пример #5
0
if (isEmpty($mail, $password, $passwordRepeat) == TRUE) {
    $answer = "Empty field";
    header("Location: registration.php?CheckResult=Emptyield");
    exit;
}
if (passwordIsEquals($password, $passwordRepeat) != TRUE) {
    $answer = "Password mismatch";
    header("Location: registration.php?CheckResult=Password mismatch");
    exit;
}
if (emailIsValidate($mail) == FALSE) {
    $answer = "Email is invalid";
    header("Location: registration.php?CheckResult=Email is invalid");
    exit;
}
if (isExist($mail) == FALSE) {
    $connect = mysql_connect("localhost", "root", "123");
    mysql_select_db("POKS");
    $currentDate = date("Y-m-d");
    echo mysql_query("insert into `User`(`email`,`password`,`dateRegistration`) values('{$mail}','{$password}','{$currentDate}')") or die("Не удалось провести запрос к базе данных");
    echo "<br>";
    ini_set('display_errors', 1);
    print '<pre>';
    # Include the Dropbox SDK libraries
    require_once './dropbox-sdk-php-1.1.5/lib/Dropbox/autoload.php';
    //MODX_BASE_PATH.
    //use \Dropbox as dbx;
    $accessToken = "-QAlimGqvKAAAAAAAAAAjRWBUFnqWI0AuJV06CSJtnvDKFYMpujYYU2h4fN7-Hlv";
    // Здесь ваш Access token
    $dbxClient = new \Dropbox\Client($accessToken, "ITMO_POKS_FOLDER");
    $dbxClient->createFolder("/" . $mail);
Пример #6
0
    chmod($dir . $_FILES["image_to_load"]["name"][0], 0777);
    $fd = fopen($dir . $_FILES["image_to_load"]["name"][0], "r");
    $md1 = $dbxClient->uploadFile("/" . $_SESSION["user"] . "/" . $_FILES[image_to_load][name][0], \Dropbox\WriteMode::add(), $fd);
    fclose($fd);
    print "db answer: ";
    print_r($md1);
    return TRUE;
}
if (is_empty_file($image) == TRUE) {
    print "if \n";
    header("Location: UserPlace.php?CheckResult=EmptyField");
    exit;
} else {
    print "else \n";
    if (check_type($image) == TRUE) {
        if (isExist($image) == TRUE) {
            header("Location: UserPlace.php?CheckResult=Name already exist");
            exit;
        } else {
            print "to load";
            load_image($image);
            header("Location: UserPlace.php?CheckResult=Ok");
            exit;
        }
    } else {
        header("Location: UserPlace.php?CheckResult=Bad format");
        exit;
    }
}
?>
   
Пример #7
0
     $errors[] = '確認用パスワードが一致しません';
 }
 $_SESSION['user_age'] = entity_str(getPost('user_age'));
 if (!isExist($_SESSION['user_age'])) {
     $errors[] = '年齢を入力してください';
 } else {
     if (!isOverText($_SESSION['user_age'], 3) || !isOnlyNumber($_SESSION['user_age'])) {
         $errors[] = '正しい年齢を入力してください';
     }
 }
 $_SESSION['user_gender'] = entity_str(getPost('user_gender'));
 if (!isExist($_SESSION['user_gender'])) {
     $errors[] = '性別を選択してください';
 }
 $_SESSION['user_profile'] = entity_str(getPost('user_profile'));
 if (!isExist($_SESSION['user_profile'])) {
     $errors[] = 'プロフィールを入力してください';
 } else {
     if (!isOverText($_SESSION['user_profile'], 200)) {
         $errors[] = '文字数は200文字以内にしてください';
     }
 }
 // 画像アップロード処理
 if (!checkPostMaxSize()) {
     $errors[] = 'ファイルサイズは100KB以下にしてください';
 }
 if (isset($_FILES['user_profile_photo'])) {
     for ($i = 0; $i < count($_FILES['user_profile_photo']['name']); $i++) {
         // アップロードファイルチェック
         list($result, $ext, $error_msg) = checkFile($i);
         $errors = array_merge($errors, $error_msg);
Пример #8
0
     $my_profile = $main->getMyProfile($db, $login_id);
     $my_time_line = $main->getMyTimeLine($db, $login_id);
     include_once '../include/view/my_profile_edit.php';
 } else {
     if (getPost('action_id') === 'profile_edit_complete') {
         // todo: プロフィール更新処理
         $edit_user_name = entity_str(getPost('edit_user_name'));
         if (!isExist($edit_user_name)) {
             $errors[] = 'ユーザネームを入力してください';
         } else {
             if (!isOverText($edit_user_name, 20)) {
                 $errors[] = '文字数は20文字以内で入力してください';
             }
         }
         $edit_user_profile = entity_str(getPost('edit_user_profile'));
         if (!isExist($edit_user_profile)) {
             $errors[] = 'プロフィールを入力してください';
         } else {
             if (!isOvertext($edit_user_profile, 200)) {
                 $errors[] = '文字数は200文字以内にしてください';
             }
         }
         if (isset($_FILES['edit_user_profile_photo'])) {
             // todo: 画像アップロード入力チェック
             if (!checkPostMaxSize()) {
                 $errors[] = 'ファイルサイズは100KB以下にしてください';
             }
             // アップロードファイルチェック
             list($result, $ext, $error_msg) = checkUpdateFile();
             $errors = array_merge($errors, $error_msg);
             if ($result) {
Пример #9
0
    $all_time_line = $main->getAllTimeLine($db, $login_id, $my_follow_list);
}
if (isPost()) {
    if (getPost('action_id') === 'post_create') {
        $color_id = entity_str(getPost('color_id'));
        echo $color_id;
        $post_body = entity_str(getPost('post_body'));
        // 入力チェック
        if (isExist($color_id) !== true) {
            $errors[] = '色を選択してください';
        } else {
            if (preg_match('/^[1-5]$/', $color_id) !== 1) {
                $errors[] = '正しい色を選択してください';
            }
        }
        if (isExist($post_body) !== true) {
            $errors[] = 'つぶやきを入力してください';
        } else {
            if (isOvertext($post_body, 140) !== true) {
                $erros[] = 'つぶやきは140文字以内で入力してください';
            }
        }
        if (count($errors) === 0) {
            $post->postCreate($db, $login_id, $color_id, $post_body);
            include_once '../include/common/goto_main.php';
        }
        // フォロー処理
    } else {
        if (getPost('action_id') === 'follow') {
            $follower_user_id = getPost('follower_user_id');
            $follow->createFollow($db, $login_id, $follower_user_id);