本文整理汇总了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;
}
示例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 {
示例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());