当前位置: 首页>>代码示例>>PHP>>正文


PHP has_presence函数代码示例

本文整理汇总了PHP中has_presence函数的典型用法代码示例。如果您正苦于以下问题:PHP has_presence函数的具体用法?PHP has_presence怎么用?PHP has_presence使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了has_presence函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate_presence

function validate_presence($required_field)
{
    global $errors;
    $value = trim($_POST[$required_field]);
    if (!has_presence($value)) {
        $errors[$required_field] = fieldname_as_text($required_field) . " can't be blank!";
    }
}
开发者ID:rodneywells01,项目名称:NickWeb,代码行数:8,代码来源:validation_functions.php

示例2: validate_fields

function validate_fields($fields)
{
    global $errors;
    if (!has_presence($fields["email"])) {
        $errors[] = "Email can't be blank";
    }
    if (!has_presence($fields["password"]) && !isset($_SESSION['id'])) {
        $errors[] = "Password can't be blank";
    }
    if (has_presence($fields["password"]) && $fields["confirm_password"] !== $fields["password"]) {
        $errors[] = "Confirm Password Has To be Identical to Password";
    }
    if (has_presence($fields["email"])) {
        $current_user = "";
        $result = find_user_by_email($fields["email"]);
        $user = mysqli_fetch_row($result);
        if (isset($_SESSION['id'])) {
            $current_user = mysqli_fetch_row(find_user_by_id($_SESSION['id']));
        }
        if ($user && $user !== $current_user) {
            // email is the 4th column in table user
            $errors[] = "Email Already Exists";
        }
    }
    // user regex to check email validity
}
开发者ID:abdoofathy95,项目名称:e_shop,代码行数:26,代码来源:functions.php

示例3: validat_presence

function validat_presence($required_fields)
{
    global $errors;
    foreach ($required_fields as $field) {
        if (!has_presence($field)) {
            $errors[$field] = ucfirst($field) . "can't be blank";
        }
    }
}
开发者ID:badadiss,项目名称:basic-CMS,代码行数:9,代码来源:functions.php

示例4: validate_presence_on

function validate_presence_on($required_fields)
{
    global $errors;
    foreach ($required_fields as $field) {
        if (!has_presence($_POST[$field])) {
            $errors[$field] = "'" . "' can't be blank";
        }
    }
}
开发者ID:KenpoJ,项目名称:student_portal,代码行数:9,代码来源:validations.php

示例5: all_prestnt

function all_prestnt($name_fields_presence)
{
    global $errors;
    foreach ($name_fields_presence as $field) {
        $value = trim($_POST[$field]);
        if (!has_presence($value)) {
            $errors[$field] = ucfirst($field) . " cannot be blank ";
        }
    }
}
开发者ID:raj143225,项目名称:Assignment,代码行数:10,代码来源:validate.php

示例6: validate_presences

function validate_presences($input_text)
{
    global $errors;
    foreach ($input_text as $field) {
        // $value = trim($_POST[$field]);
        if (!has_presence($_POST[$field])) {
            $errors[$field] = fieldname_as_text($field) . " can't be blank";
        }
    }
}
开发者ID:natac13,项目名称:PHP-Basics-CMS-Project,代码行数:10,代码来源:validation_functions.php

示例7: validate_presences

function validate_presences($required_fields)
{
    global $errors;
    foreach ($required_fields as $field) {
        $value = trim($_POST[$field]);
        if (!has_presence($value)) {
            $errors[$field] = fieldname_as_text($field) . "  can't be blank";
        }
    }
}
开发者ID:AhmedMedo,项目名称:Content,代码行数:10,代码来源:validation_functions.php

示例8: validate_presences_general

function validate_presences_general($required_fields, $array)
{
    global $errors;
    $result = 1;
    foreach ($required_fields as $field) {
        $value = trim($array[$field]);
        if (!has_presence($value)) {
            $errors[$field] = fieldname_as_text($field) . " can't be blank";
            $result = 0;
        }
    }
    return $result;
}
开发者ID:marcogreselin,项目名称:auctionbay,代码行数:13,代码来源:validation_functions.php

示例9: validate_presences

function validate_presences($required_fields)
{
    global $errors;
    foreach ($required_fields as $field) {
        if ($field == 'visible') {
            if (!isset($_POST['visible'])) {
                $errors['visible'] = "visible can't be unchecked";
            }
        } else {
            $value = trim($_POST[$field]);
            if (!has_presence($value)) {
                $errors[$field] = fieldname_as_text($field) . " can't be blank";
            }
        }
    }
}
开发者ID:VishnuArukat,项目名称:phpcodepool,代码行数:16,代码来源:validation_function.php

示例10:

 if (!has_max_length($greeting, 500)) {
     $errors['greeting'] = "Please limit your greeting to 500 characters.";
 }
 if (!has_presence($friendfirst)) {
     $errors['friendfirst_blank'] = "Please provide your friend's name.";
 }
 if (!has_presence($toemail)) {
     $errors['toemail_blank'] = "Please provide your friend's email address.";
 }
 if (!has_presence($firstname)) {
     $errors['firstname_blank'] = "Please provide your first name.";
 }
 if (!has_presence($fromemail)) {
     $errors['fromemail_blank'] = "Please provide your email address.";
 }
 if (!has_presence($image)) {
     $errors['image_blank'] = "Please select an image for your E-Card.";
 }
 // Error message (could print here, but do it lower down instead)
 // print form_errors($errors);
 // No Errors
 if (empty($errors)) {
     // Select image file & credit text
     $html_image = $image_file[$pos];
     $html_credit = $image_credit[$pos];
     // BUILD EMAIL
     $html_email = "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
     $html_email .= "<html>\n";
     $html_email .= "<head>\n";
     $html_email .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n";
     $html_email .= "<title>Harvard Library Holiday Card from " . $firstname . "</title>\n";
开发者ID:KathleenImbert,项目名称:ecard-generator,代码行数:31,代码来源:ecard.php

示例11: htmlspecialchars

         $user_email = htmlspecialchars($_POST['user_email']);
         $user_data['user_email'] = $user_email;
     } else {
         $user_email = htmlspecialchars($_POST['user_email']);
         $errors[] = "Please enter a valid email address";
     }
 } else {
     $user_email = "";
     $errors[] = "Please enter an email address";
 }
 // check for presence of a password
 if (has_presence($_POST['user_password'])) {
     // make sure its at least 7 characters long
     if (has_min_length($_POST['user_password'], 7)) {
         // check for presence of a conf_password
         if (has_presence($_POST['conf_password'])) {
             // compare the two password for exactness
             if (is_exact($_POST['user_password'], $_POST['conf_password'])) {
                 // passwords match
                 $user_password = htmlspecialchars($_POST['conf_password']);
                 $conf_password = htmlspecialchars($_POST['conf_password']);
                 // hash protect password
                 $hash_password = password_hash($user_password, PASSWORD_DEFAULT);
                 $user_data['user_password'] = $hash_password;
             } else {
                 $user_password = "";
                 $conf_password = "";
                 $errors[] = "Your passwords didn't match";
             }
         } else {
             $user_password = htmlspecialchars($_POST['user_password']);
开发者ID:songfarm-david,项目名称:Songfarm,代码行数:31,代码来源:register_copy.php

示例12: array

require_once "../includes/sessions.php";
require_once "../includes/functions.php";
require_once "../includes/validation-functions.php";
require_once "../includes/db-connection.php";
?>

<?php 
// Temporary hack to simulate logged in user
$user_id = 1;
if (isset($_POST['submit-new-mc-question'])) {
    // The New Multiple Choice Form was submitted
    // Validate New User Form inputs
    $fields_required = array("question_text", "answer1", "answer2", "answer3", "answer4", "weight");
    foreach ($fields_required as $field) {
        $value = trim($_POST[$field]);
        if (!has_presence($value)) {
            $error_messages[$field] = ucfirst($field) . " is required.";
        }
    }
    // If there were errors, redirect back to the form.
    if (!empty($error_messages)) {
        $_SESSION["errors"] = $error_messages;
        $form_values = array("question_text" => $_POST['question_text'], "answer1" => $_POST['answer1'], "answer2" => $_POST['answer2'], "answer3" => $_POST['answer3'], "answer4" => $_POST['answer4'], "weight" => $_POST['weight']);
        $_SESSION["form_history"] = $form_values;
        redirect_to("new-question.php");
    }
    // If inputs were valid begin insertion.
    $_POST = array_map('mysql_real_escape_string', $_POST);
    $question_text = $_POST['question_text'];
    $answer1 = $_POST['answer1'];
    $answer2 = $_POST['answer2'];
开发者ID:jelordreygulle,项目名称:php_quiz_maker,代码行数:31,代码来源:process-new-mc-question.php

示例13: foreach

 foreach ($fields_required as $field) {
     $value = trim($_POST[$field]);
     if (!has_presence($value)) {
         $error_messages[$field] = ucfirst($field) . " is required.";
     }
 }
 // If there are no errors, proceed with the update.
 if (empty($error_messages)) {
     $_POST = array_map('addslashes', $_POST);
     $_POST = array_map('htmlentities', $_POST);
     $quiz_id = $id;
     $quiz_name = $_POST['quiz_name'];
     $category = $_POST['category'];
     $deadline = $_POST['deadline'];
     $attempts = $_POST['attempts'];
     if (!has_presence($deadline)) {
         $query = "UPDATE quiz SET ";
         $query .= "quiz_name = '{$quiz_name}', ";
         $query .= "category = '{$category}', ";
         $query .= "deadline = NULL, ";
         $query .= "attempts = '{$attempts}' ";
         $query .= "WHERE quiz_id = {$quiz_id} ";
         $query .= "LIMIT 1";
     } else {
         $query = "UPDATE quiz SET ";
         $query .= "quiz_name = '{$quiz_name}', ";
         $query .= "category = '{$category}', ";
         $query .= "deadline = '{$deadline}', ";
         $query .= "attempts = '{$attempts}' ";
         $query .= "WHERE quiz_id = {$quiz_id} ";
         $query .= "LIMIT 1";
开发者ID:jelordreygulle,项目名称:quizmaster,代码行数:31,代码来源:edit-quiz.php

示例14: die

    if (!$result2) {
        die("database failed at layou1_edit form starting." . mysqli_error($connection));
    }
    $row2 = mysqli_fetch_assoc($result2);
}
if (!check_auth("3")) {
    $_SESSION["message"] = "Not Authorised To Approve Or Cancel Jumper";
    $_SESSION["message_color"] = "red";
    if (isset($_GET["jumperid"])) {
        redirect_to("layout2.php?jumperid={$_GET["jumperid"]}");
    } else {
        redirect_to("search.php");
    }
}
if (isset($_POST["app_jumper"])) {
    if (!has_presence($_POST["valid_upto"])) {
        //mandatory fields are not present
        $_SESSION["error_messages"][] = "All Field Marked * Are Mandatory.";
        redirect_to("layout2_edit.php?jumperid={$_GET["jumperid"]}");
    }
    if (!preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}\$/", $_POST["valid_upto"])) {
        //mandatory fields are not present
        $_SESSION["error_messages"][] = "PLease Enter Valid Date";
        redirect_to("layout2_edit.php?jumperid={$_GET["jumperid"]}");
    }
    if (!($row2["vcStatus"] == "NEW")) {
        $_SESSION["message"] = "Approval can be given only once, to a New Jumper.";
        $_SESSION["message_color"] = "red";
        redirect_to("layout2.php?jumperid={$_GET["jumperid"]}");
    }
    //update the database
开发者ID:ashk43712,项目名称:Jumper,代码行数:31,代码来源:layout2_edit.php

示例15: array

<!DOCTYPE html>
<html>
<head>
	<title>php</title>
</head>
<body>
	<?php 
require 'lynda_9.php';
$errors = array();
$username = trim("");
if (!has_presence($username)) {
    $errors['username'] = "Username can not be empty!";
}
// print_r($errors);
echo form_errors($errors);
?>
	<body>
</html>
开发者ID:sydorenkovd,项目名称:test-items,代码行数:18,代码来源:lynda_10.php


注:本文中的has_presence函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。