本文整理汇总了PHP中Post::Check方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::Check方法的具体用法?PHP Post::Check怎么用?PHP Post::Check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Post
的用法示例。
在下文中一共展示了Post::Check方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Email
<?php
/**
* Check post objects
*/
$post_check = Post::Check(array("msg", "name", "email"));
/**
* If post objects are set and not empty, continue to post email
*/
if ($post_check) {
try {
/**
* Start Email class and try to send the email
*/
$email = new Email();
$email->MailFrom($_POST['email']);
$email->MailTo($_['MAIL_FROM']);
$email->Subject($_['MAIL_SUBJECT']);
$email->Content($_POST['msg']);
$email->SendMail();
/**
* Build an array on success
*/
$success = array("msg" => $_['EMAIL_SENT'], "response" => 1);
/**
* Pass it to javascript with json
*/
echo json_encode($success);
} catch (Exception $e) {
/**
* Email sending failed, prepare an array for error
示例2: Permission
<?php
$perms = new Permission();
if (!$perms->IsAllowed('history')) {
Exceptions::PrintOut("You do not have access to the History");
}
/**
* Check $_POST variables for "search"
*/
$post_check = Post::Check(array("search"));
if ($post_check) {
/**
* If variable is passed, search for the historic messages with passed variable
*/
$historic = History::SearchHistory($_POST['search']);
} else {
/**
* Else output the default historic messages
*/
$historic = History::ListHistory();
}
include 'views/template/history.html';
示例3: UploadStatus
<?php
$post = Post::Check(array("user", "status"));
if ($post) {
$status = new UploadStatus($_POST['status'], $_POST['user']);
}
示例4: isset
<?php
/**
* Check the $_POST variables: "msg" and "to"
*/
$post_check = Post::Check(array("msg", "to"));
if ($post_check) {
/**
* If variables are passed we set the $html variable. This defines
* if html is allowed or not. We don't allow html for messages, but
* we will have to allow it when administrator sends a file to the user.
*/
$html = isset($_GET['html']) && $_GET['html'] == 1 ? true : false;
if ($_POST['to'] > 0) {
/**
* Add message if there is someone to pass it
*/
$post = new AddMsg($_POST['msg'], $_POST['to'], $html);
}
}
/**
* Start Messaging class
*/
$msg = new Messaging();
/**
* Delete all messages older that 520 minutes. This can be adjusted, but must
* be adjusted in the client area as well, because all the users trigger this
* function.
*/
$msg->DeleteOld(520);
/**
示例5: Permission
<?php
$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
* Check if post names are set
*/
$post_check = Post::Check(array("title", "users", "banned", "history"));
/**
* If post names are all set, try to insert the group
*/
if ($post_check) {
$new_user = new UsersAndGroups();
$result = $new_user->NewGroup($_POST['title'], array($_POST['users'], $_POST['banned'], $_POST['history']));
/*
* If result is not true, output the error variable
*/
if (!$result) {
$error = $new_user->error;
}
}
/**
* Include view template file
*/
include 'views/template/new_group.html';
示例6: Permission
<?php
$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
* Check if $_GET['id] is set and is greater than 0
*/
$id_check = Post::GCheck(array('id'));
/*
* If id is ok and we are not editing administrators group proceed with operation
*/
if ($id_check) {
$id = $_GET['id'];
$post_check = Post::Check(array("username", "group"));
if ($post_check) {
$edit = new UsersAndGroups();
$result = $edit->UserEditor($id, $_POST['password'], $_POST['password2'], $_POST['group']);
if (!$result) {
$error = $edit->error;
}
}
$user = UsersAndGroups::GetUser($id);
/**
* List groups to select element
*/
$groups = UsersAndGroups::ListGroups();
include 'views/template/useredit.html';
} else {
/*
示例7: array
<?php
$fields = array("username", "password");
/**
* Check the $_POST for fields "username" and "password"
*/
$checkfields = Post::Check($fields);
$post = $_POST;
/**
* Start login class
*/
$login = new Login();
/**
* Set the name of the cookie that will hold remember status
*/
$login->SetCookieName('login');
/**
* Continue if $checkfield are passed
*/
if ($checkfields) {
/**
* If remember hidden field is set, fill the remember variable with 1
*/
$remember = isset($post['remember']) ? $post['remember'] : "";
/**
* Set the passed credentials to function
*/
$login->SetCredentials($post['username'], $post['password'], $remember);
/**
* Check if login succeded
*/
示例8: Permission
<?php
$perms = new Permission();
if (!$perms->IsAllowed('banned')) {
Exceptions::PrintOut("You do not have access to the Banned area");
}
/**
* Check if $_POST variable user has been set and ban the user.
*/
$check = Post::Check(array("user"));
if ($check) {
UserBan::BanUser($_POST['user']);
}
示例9: ChangeNick
<?php
$check_post = Post::Check(array("nick"));
if ($check_post) {
$new_nick = new ChangeNick($_POST['nick']);
$new_nick->ChangeIt();
}
示例10: Permission
<?php
$perms = new Permission();
if (!$perms->IsAllowed('groups')) {
Exceptions::PrintOut("You do not have access to the Users and groups");
}
/**
* Check if post names are set
*/
$post_check = Post::Check(array("username", "password", "password2", "group"));
/**
* If post names are all set, try to insert the user
*/
if ($post_check) {
$new_user = new UsersAndGroups();
$result = $new_user->NewUser($_POST['username'], $_POST['password'], $_POST['password2'], $_POST['group']);
/*
* If result is not true, output the error variable
*/
if (!$result) {
$error = $new_user->error;
}
}
/**
* List groups to select element
*/
$groups = UsersAndGroups::ListGroups();
/**
* Include view template file
*/
include 'views/template/new_user.html';