コード例 #1
0
ファイル: checkregister.php プロジェクト: BourgondAries/e622
<?php

require_once 'models/Http.php';
require_once 'models/User.php';
$parameters = '&username='******'username') . '&email=' . Http::get('email');
if (Http::has('username') == false) {
    header("Location: /register/reason=no_username{$parameters}");
    die;
}
if (Http::has('email') == false) {
    header("Location: /register/reason=no_email{$parameters}");
    die;
}
if (Http::has('password') == false || Http::has('password_retype') == false) {
    header("Location: /register/reason=no_password{$parameters}");
    die;
}
if (Http::get('password') != Http::get('password_retype')) {
    header("Location: /register/reason=password_not_match{$parameters}");
    die;
}
$user = new User();
$result = $user->register(Http::get('username'), Http::get('email'), Http::get('password'));
switch ($result) {
    case 'success':
        header('Location: /login');
        break;
    default:
        header('Location: ' . "/register/reason={$result}{$parameters}");
        break;
}
コード例 #2
0
ファイル: changeuser.php プロジェクト: BourgondAries/e622
<?php

require_once 'models/Http.php';
require_once 'models/User.php';
if (Http::has('user') && Http::has('username') && Http::has('email') && Http::has('password') && Http::has('password_retype') && Http::has('privilege')) {
    if ($username = User::getCurrentLogin()) {
        $user = new User();
        $result = $user->change(Http::get('user'), Http::get('username'), Http::get('email'), Http::get('password'), Http::get('old_password'), Http::get('privilege'), $username);
        echo $result;
        if (Http::get('user') == $username && $result == 'success') {
            $working_password = Http::get('password') != '' ? Http::get('password') : Http::get('old_password');
            if ($user->loginUsername(Http::get('username'), $working_password) == 'success') {
                User::logout();
                User::setCurrentLoginForced(Http::get('username'));
            } else {
                header('Location: /');
                die;
            }
            $newusername = Http::get('username');
            $time = date('H:i:s');
            header("Location: /user/{$newusername}/reason=success&time={$time}");
        } else {
            if ($result == 'nothing_changed') {
                $newusername = Http::get('username');
                header("Location: /user/{$newusername}/reason={$result}");
            } else {
                if ($result == 'success') {
                    $newusername = Http::get('username');
                    $time = date('H:i:s');
                    header("Location: /user/{$newusername}/reason=success&time={$time}");
                } else {
コード例 #3
0
ファイル: upload.php プロジェクト: BourgondAries/e622
<?php

require_once 'models/Http.php';
require_once 'models/User.php';
require_once 'views/Standard.php';
require_once 'views/UploadPage.php';
$notice = '';
if (Http::has('newid')) {
    $notice = UploadPage::renderSuccess(Http::get('newid'));
} else {
    if (Http::has('reason')) {
        $notice = UploadPage::renderFail(Http::get('reason'));
    }
}
$upload_form = UploadPage::render(Http::get('description'), Http::get('taglist'), Http::get('newid'), Http::get('autolink'));
echo Standard::render(UploadPage::renderInformation($notice), $upload_form, User::generateLoginState());