当前位置: 首页>>代码示例>>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;未经允许,请勿转载。