本文整理汇总了PHP中POST函数的典型用法代码示例。如果您正苦于以下问题:PHP POST函数的具体用法?PHP POST怎么用?PHP POST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了POST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editOrSave
private function editOrSave($action)
{
$validations = array("exists" => array("Slug" => slug(POST("title", "clean")), "Year" => date("Y"), "Month" => date("m"), "Day" => date("d"), "Language" => POST("language")), "title" => "required", "content" => "required");
$this->categories = POST("categories");
$this->tags = POST("tags");
$this->URL = PATH("blog/" . date("Y")) . "/" . date("m") . "/" . date("d") . "/" . slug(POST("title", "clean"));
$this->muralExist = POST("mural_exist");
$this->Files = $this->core("Files");
$this->mural = FILES("mural");
if ($this->mural["name"] !== "") {
$dir = "www/lib/files/images/mural/";
$this->mural = $this->Files->uploadImage($dir, "mural", "mural");
if (is_array($this->mural)) {
return $this->mural["alert"];
}
}
$dir = "www/lib/files/images/blog/";
$this->image = $this->Files->uploadImage($dir, "image", "resize", TRUE, TRUE, FALSE);
$data = array("ID_User" => SESSION("ZanUserID"), "ID_URL" => 1, "Slug" => slug(POST("title", "clean")), "Content" => POST("content", "clean"), "Author" => SESSION("ZanUser"), "Year" => date("Y"), "Month" => date("m"), "Day" => date("d"), "Image_Small" => isset($this->image["small"]) ? $this->image["small"] : NULL, "Image_Medium" => isset($this->image["medium"]) ? $this->image["medium"] : NULL, "Pwd" => POST("pwd") ? POST("pwd", "encrypt") : NULL, "Start_Date" => now(4), "Text_Date" => now(2));
$this->Data->ignore(array("categories", "tags", "mural_exists", "mural", "pwd", "category", "language_category", "application", "mural_exist"));
$this->data = $this->Data->proccess($data, $validations);
if (isset($this->data["error"])) {
return $this->data["error"];
}
}
示例2: validate_post_params
function validate_post_params($conn, $name, $descr, $sids, $imported_sids)
{
$vals = array('name' => array(OSS_INPUT, 'illegal:' . _("Name")), 'descr' => array(OSS_TEXT, OSS_NULLABLE, 'illegal:' . _("Description")));
ossim_valid($name, $vals['name']);
ossim_valid($descr, $vals['descr']);
$plugins = array();
$sids = is_array($sids) ? $sids : array();
if (intval(POST('pluginid')) > 0) {
$sids[POST('pluginid')] = "0";
}
foreach ($sids as $plugin => $sids_str) {
if ($sids_str !== '') {
list($valid, $data) = Plugin_sid::validate_sids_str($sids_str);
if (!$valid) {
ossim_set_error(_("Error for data source ") . $plugin . ': ' . $data);
break;
}
if ($sids_str == "ANY") {
$sids_str = "0";
} else {
$aux = count(explode(',', $sids_str));
$total = Plugin_sid::get_sidscount_by_id($conn, $plugin);
$sids_str = $aux == $total ? "0" : $sids_str;
}
$plugins[$plugin] = $sids_str;
}
}
if (!count($plugins) && !count($imported_sids)) {
ossim_set_error(_("No Data Sources or Event Types selected"));
}
if (ossim_error()) {
die(ossim_error());
}
return array($name, $descr, $plugins);
}
示例3: update
public function update()
{
if (isset($_POST['mail']) && isset($_POST['pwd'])) {
$mail = POST('mail');
$password = secure_strip(POST('pwd'));
if (($val = $this->model->login_with_password($mail, $password)) !== 0) {
if ($val === 1) {
$field = "Le mot de passe entré est éronné";
} else {
$field = "L'adresse mail est inconnue";
}
echo <<<TEXT
<p>Une erreur est survenue : <br/>
{$field}
</p>
TEXT;
return;
} else {
echo "<p>Logged</p>";
$testAdm = $this->model->isAdmin($_SESSION['ID']);
if ($testAdm === 'admin') {
$_SESSION['admin'] = $testAdm;
}
}
}
return;
}
示例4: vote
public function vote()
{
if (!POST("answer")) {
showAlert("You must select an answer", _webBase);
}
$this->Polls_Model->vote();
showAlert("Thanks for your vote", _webBase);
}
示例5: data
public function data()
{
if ($this->method() === "PUT") {
parse_str(file_get_contents("php://input"), $data);
} elseif ($this->method() === "POST" or $this->method() === "DELETE") {
$data = POST(true);
}
return isset($data) ? $data : false;
}
示例6: search
public function search($search = FALSE)
{
if (!$search) {
$search = POST("search");
}
if ($search) {
$vars["response"] = $this->Videos_Model->search($search);
} else {
$vars["response"] = FALSE;
}
print json($vars);
}
示例7: get_pulse_detail
function get_pulse_detail()
{
$data = POST('data');
ossim_valid($data['pulse_id'], OSS_HEX, 'illegal: Pulse ID');
if (ossim_error()) {
return array();
}
$otx = new Otx();
$pulse = $otx->get_pulse_detail($data['pulse_id']);
//Converting indicator hash to array to use it in the datatables.
$pulse['indicators'] = array_values($pulse['indicators']);
return $pulse;
}
示例8: setCategory
public function setCategory()
{
if (!POST("category")) {
$vars["error"] = __("You need write category");
} elseif (!POST("language")) {
$vars["error"] = __("You need select language");
}
if (!isset($vars["error"])) {
$this->Categories_Model = $this->model("Categories_Model");
$vars["response"] = $this->Categories_Model->save();
}
print json_encode($vars);
}
示例9: login
public function login()
{
$this->title("Login");
$this->CSS("login", "users");
if (POST("connect")) {
$this->Users_Controller = $this->controller("Users_Controller");
$this->Users_Controller->login("cpanel");
} else {
$this->vars["URL"] = getURL();
$this->vars["view"] = $this->view("login", TRUE);
}
$this->render("include", $this->vars);
$this->rendering("header", "footer");
}
示例10: change_account_contribution
function change_account_contribution()
{
$data = POST('data');
$contribute = intval($data['status']);
$otx = new Otx();
if ($contribute) {
$otx->enable_contribution();
$msg = _('You are now contributing to OTX.');
} else {
$otx->disable_contribution();
$msg = _('You are not contributing to OTX anymore.');
}
return array('msg' => $msg);
}
示例11: feedback
private function feedback()
{
$this->CSS("feedback", $this->application);
$this->js("tiny-mce", NULL, "basic");
$this->title("Feedback");
if (POST("send")) {
$this->vars["alert"] = $this->Feedback_Model->send();
$this->vars["view"] = $this->view("send", TRUE);
$this->template("content", $this->vars);
} else {
$this->vars["view"] = $this->view("send", TRUE);
$this->template("content", $this->vars);
}
}
示例12: editOrSave
private function editOrSave()
{
if (!POST("title")) {
return getAlert("You need to write a title");
}
$this->ID = POST("ID_Application");
$this->title = POST("title", "decode", "escape");
$this->slug = slug($this->title);
$this->cpanel = POST("cpanel");
$this->adding = POST("adding");
$this->defult = POST("defult");
$this->category = POST("category");
$this->comments = POST("comments");
$this->situation = POST("Situation");
}
示例13: build_url
function build_url($action, $extra)
{
global $date_from, $date_to, $show_options, $src_ip, $dst_ip, $num_alarms_page, $hide_closed, $autorefresh, $refresh_time, $inf, $sup;
if (empty($action)) {
$action = "none";
}
$options = "";
if (!empty($date_from)) {
$options = $options . "&date_from=" . $date_from;
}
if (!empty($date_to)) {
$options = $options . "&date_to=" . $date_to;
}
if (!empty($show_options)) {
$options = $options . "&show_options=" . $show_options;
}
if (!empty($autorefresh)) {
$options = $options . "&autorefresh=on";
}
if (!empty($refresh_time)) {
$options = $options . "&refresh_time=" . $refresh_time;
}
if (!empty($src_ip)) {
$options = $options . "&src_ip=" . $src_ip;
}
if (!empty($dst_ip)) {
$options = $options . "&dsp_ip=" . $dsp_ip;
}
if (!empty($num_alarms_page)) {
$options = $options . "&num_alarms_page=" . $num_alarms_page;
}
if (!empty($hide_closed)) {
$options = $options . "&hide_closed=on";
}
if ($action != "change_page") {
if (!empty($inf)) {
$options = $options . "&inf=" . $inf;
}
if (!empty($sup)) {
$options = $options . "&sup=" . $sup;
}
}
$url = $_SERVER["SCRIPT_NAME"] . "?action=" . $action . $extra . $options . "&bypassexpirationupdate=1&group_type=" . POST('group_type');
return $url;
}
示例14: update
public function update()
{
if ($_SESSION["logged"] === true) {
if (isset($_POST["password1"]) && isset($_POST["password2"])) {
//change password to new password
if (POST("password1") === POST("password2")) {
$this->model->reset_password_with_id($_SESSION["ID"], POST("password1"));
$this->model->setStrategy(new PasswordChangedStrategy());
} else {
$this->model->setStrategy(new Not_To_EasyStrategy());
}
} else {
$this->model->setStrategy(new RequestStrategy());
}
} else {
/**not logged in waiting for either :
* -input mail
* -input validation
*
*/
if (isset($this->options[0])) {
//validation du token
$this->model->login_with_validation($this->options[0]);
if ($_SESSION['logged'] === true) {
//is connected, now request a new password
$this->model->setStrategy(new RequestStrategy());
} else {
//bad token, invalid ID;
$this->model->setStrategy(new SetMailStrategy());
}
} else {
//user wants to request a new password
if (isset($_POST["mail"])) {
$this->model->setStrategy(new ClickSurMailStrategy());
$mail = POST("mail");
$token = $this->model->request_password_change($mail);
$this->send_mail_for_validation($mail, $token);
} else {
// no mail set ; need to display form
$this->model->setStrategy(new SetMailStrategy());
}
}
}
}
示例15: update
public function update()
{
if (mail_check(POST('mail')) === false) {
echo 'Votre adresse est invalide';
} else {
if (isset($_POST['mail']) && isset($_POST['pwd0'])) {
$mail = POST('mail');
$password = POST('pwd0');
if ($password !== POST('pwd1')) {
//do not match
return;
}
/*if (!mail_check($mail))
{
$_SESSION['INSCRIPTION_FAILURE'] = "Adresse Email Non Valide !";
unset($_SESSION['INSCRIPTION_FAILURE']);
return;
}*/
$name = POST('fName');
$crypt = true;
$key = random_string_token(10, $crypt);
$this->model->select_user_by_mail();
$this->model->select($mail);
$this->model->join('PASSWORD');
$this->model->update();
if ($this->model->rowCount() === 0) {
//user not found -> good case
$user = new User('0', $mail, $name, 0);
$this->model->create_new_user($user, $password, $key);
$destinataire = $mail;
$sujet = "Activation de votre compte";
$entete = "From: Equipe@aaron-aaron.com";
$message = "Bienvenue sur Aaron,\n\n Pour activer votre compte, veuillez cliquer sur le lien ci-dessous\n ou copier/coller dans votre navigateur internet.,\n http://aaron-aaron.alwaysdata.net/confirmation/{$key}\n\n ---------------\n Ceci est un mail automatique, Merci de ne pas y répondre.";
mail($destinataire, $sujet, $message, $entete);
echo "Un mail vous a été envoyé sur votre adresse mail, veuillez suivre les indications pour\n continuer votre inscription.";
} else {
//mail already exists;
//$_SESSION["INSCRIPTION_FAILURE"] = "Cette adresse email existe déjà dans nos bases de données !";
}
}
}
}