當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Http::has方法代碼示例

本文整理匯總了PHP中Http::has方法的典型用法代碼示例。如果您正苦於以下問題:PHP Http::has方法的具體用法?PHP Http::has怎麽用?PHP Http::has使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Http的用法示例。


在下文中一共展示了Http::has方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: header

<?php

require_once 'models/Http.php';
require_once 'models/User.php';
$parameters = '&username=' . Http::get('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;
}
開發者ID:BourgondAries,項目名稱:e622,代碼行數:31,代碼來源:checkregister.php

示例2: User

<?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 {
開發者ID:BourgondAries,項目名稱:e622,代碼行數:31,代碼來源:changeuser.php

示例3:

<?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());
開發者ID:BourgondAries,項目名稱:e622,代碼行數:16,代碼來源:upload.php


注:本文中的Http::has方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。