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


PHP validate_presences函數代碼示例

本文整理匯總了PHP中validate_presences函數的典型用法代碼示例。如果您正苦於以下問題:PHP validate_presences函數的具體用法?PHP validate_presences怎麽用?PHP validate_presences使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: array

<?php 
$username = null;
$server_name = $_SERVER['PHP_SELF'];
$new_password = null;
?>




  <?php 
//  -begin lost
if (isset($_POST['submit'])) {
    $email = $_POST['email'];
    $required_fields = array("email");
    validate_presences($required_fields);
    validate_email("email");
    if (empty($errors)) {
    }
    $found_admin = find_admin_by_email($email);
    if ($found_admin) {
        // do not execute on localhost	(db connection)
        if ($server_name != $server_local) {
            $username = $found_admin['username'];
            $new_password = substr(md5(rand()), 0, 7);
            $id = $found_admin['id'];
            $hashed_password = password_encrypt($new_password);
            $query = "UPDATE admins SET ";
            $query .= "username = '{$username}', ";
            $query .= "hashed_password = '{$hashed_password}' ";
            $query .= "WHERE id = {$id} ";
開發者ID:kamy333,項目名稱:photo_gallery,代碼行數:30,代碼來源:login_lost_pwd.php

示例2: foreach

 // var_dump($_POST);
 foreach ($_POST as $key => $value) {
     $temp = is_array($value) ? $value : trim($value);
     if (empty($temp) && in_array($key, $required_fields)) {
         // $missing[] = $key;
         ${$key} = '';
     } elseif (in_array($key, $expected)) {
         ${$key} = $temp;
     }
 }
 if (isset($pseudo)) {
     $type_transport = type_transport($pseudo);
 }
 $aller_retour = "AllerSimple";
 validate_presences($required_fields);
 validate_presences($warning_fields, true);
 validate_chauffeur_by_name($chauffeur);
 //    validation_pseudo_clients($pseudo);
 //    validate_pseudo($pseudo,$pseudo_autres,$nom_patient,true);
 //    validate_pseudo_bon_no($pseudo,$bon_no,true);
 if (isset($chauffeur)) {
     validate_chauffeur_by_name($chauffeur);
 }
 if (isset($pseudo)) {
     validation_pseudo_clients($pseudo);
 }
 if (isset($pseudo) && isset($pseudo_autres) && isset($nom_patient)) {
     validate_pseudo($pseudo, $pseudo_autres, $nom_patient, true);
 }
 if (isset($pseudo) && isset($bon_no)) {
     validate_pseudo_bon_no($pseudo, $bon_no, true);
開發者ID:kamy333,項目名稱:kamy,代碼行數:31,代碼來源:10_modele.php

示例3: process_feedback_form

/** Form processing for the feedback form */
function process_feedback_form()
{
    global $errors;
    $required_fields = array("stars", "comment", "title");
    validate_presences($required_fields);
    $fields_with_max_lengths = array("title" => 20);
    validate_max_lengths($fields_with_max_lengths);
    if (empty($errors)) {
        leaveFeedback();
    }
}
開發者ID:marcogreselin,項目名稱:auctionbay,代碼行數:12,代碼來源:form_processing.php

示例4: check_event_add

function check_event_add()
{
    if (isset($_POST['add'])) {
        // User is adding an event.
        global $connection;
        global $errors;
        // Determine add target.
        $query = "SELECT * FROM events";
        $response = mysqli_query($connection, $query);
        $addtarget = (int) mysqli_num_rows($response) + 1;
        // Validate data.
        $required_fields = array("event_name{$addtarget}", "event_location{$addtarget}", "event_datetime{$addtarget}", "event_description{$addtarget}");
        validate_presences($required_fields);
        foreach ($required_fields as $value) {
            $_POST[$value] = mysql_prep($_POST[$value]);
        }
        // Update Database with new data.
        if (empty($errors)) {
            $query = "INSERT INTO events (";
            $query .= " name, location, description, datetime";
            $query .= ") VALUES (";
            $query .= " '{$_POST["event_name" . $addtarget]}', \n\t\t\t    \t\t\t'{$_POST["event_location" . $addtarget]}', \n\t\t\t    \t\t\t'{$_POST["event_description" . $addtarget]}', \n\t\t\t    \t\t\t'{$_POST["event_datetime" . $addtarget]}'";
            $query .= ")";
            $result = mysqli_query($connection, $query);
            confirm_query($result);
            $_SESSION["message"] = "Event added!";
        } else {
            $_SESSION["message"] = "Event add failed! Try again?";
        }
        redirect_to("index.php?redirect=events");
    }
}
開發者ID:rodneywells01,項目名稱:NickWeb,代碼行數:32,代碼來源:functions.php


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