• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP has_presence函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: htmlspecialchars

     } else {
         $email = htmlspecialchars($_POST['email']);
         $errors[] = "Please enter a valid email address";
     }
 } else {
     $email = "";
     $errors[] = "Please enter an email address";
 }
 // if there's a subject, clean it up
 if (has_presence($_POST['subject'])) {
     $subject = htmlspecialchars($_POST['subject']);
 } else {
     $subject = "";
 }
 // check for presence of a message
 if (has_presence($_POST['message'])) {
     // if it's at least 3 characters long
     if (has_min_length($_POST['message'], 3)) {
         $message = wordwrap(htmlspecialchars($_POST['message']), 70);
     } else {
         $message = htmlspecialchars($_POST['message']);
         $errors[] = "Please write more than 2 words";
     }
 } else {
     $message = "";
     $errors[] = "Please write a comment before trying to send the form.";
 }
 // if no errors, then assemble the email
 if (empty($errors)) {
     $to = 'David Gaskin <[email protected]>';
     // this may cause a bug on Windows systems
开发者ID:songfarm-david,项目名称:songfarm-jul2015,代码行数:31,代码来源:contact_form_val.php


示例17: validate_presences_non_post

function validate_presences_non_post($required_fields, $record, $warning_me = false)
{
    // not coming from post but by query db returning record set eg program 1 record as arrey
    global $errors;
    global $warnings;
    $msg_presence = array();
    foreach ($required_fields as $field) {
        $value = trim($record[$field]);
        if (!has_presence($value)) {
            if ($warning_me) {
                $warnings[$field] = fieldname_as_text($field) . " n'est pas rempli";
                $msg_presence[$field] = $warnings[$field];
                //    $msg_presence[$field]=get_warning_error($warnings[$field],$warning_me);
                //  var_dump($warnings[$field]);
            } else {
                $errors[$field] = fieldname_as_text($field) . " n'est pas rempli ";
                $msg_presence[$field] = $errors[$field];
                //   $msg_presence[$field]=get_warning_error($errors[$field],$warning_me);;
            }
            //   var_dump(debug_backtrace());
        }
    }
    return $msg_presence;
}
开发者ID:kamy333,项目名称:kamy,代码行数:24,代码来源:validation_functions.php


示例18: array_push

    }
    if (!has_presence($address)) {
        array_push($errors, "Address can't be blank");
    } else {
        if (!preg_match('/^[a-zA-Z0-9\\s,\'-]+$/', $address)) {
            array_push($errors, "Invalid entry in address");
        }
    }
    if (!has_presence($gender)) {
        array_push($errors, "Please select a gender");
    } else {
        if ($gender != 'male' && $gender != 'female') {
            array_push($errors, "Please select a Valid gender");
        }
    }
    if (!has_presence($education)) {
        array_push($errors, "Please select a education type");
    }
    if (!empty($errors)) {
        /*If there are any errors print them else display the data*/
        echo "<p class='failure'>There were some errors while processing form</p>";
        echo "<ul class='failure'>";
        foreach ($errors as $error_value) {
            echo "<li>" . $error_value . "</li>";
        }
    } else {
        /*Display the form input*/
        ?>
			<p class='success'>Form Submission successfull</p>
			<table>
				<tr>
开发者ID:Prasadidasi,项目名称:JSPSample,代码行数:31,代码来源:process.php


示例19: check_session_timeout

}
check_session_timeout();
if (!check_auth("2")) {
    $_SESSION["message"] = "Not Authorised To Edit Or Create Jumper";
    $_SESSION["message_color"] = "red";
    if (isset($_GET["jumperid"])) {
        redirect_to("layout1.php?jumperid={$_GET["jumperid"]}");
    } else {
        redirect_to("search.php");
    }
}
require_once "../includes/validation_functions.php";
if (isset($_POST["submit"])) {
    $_SESSION["error_messages"] = array();
    $flag = 0;
    if (!has_presence($_POST["loc_mod"]) || !has_presence($_POST["dr_no"]) || !has_presence($_POST["tag_unit"]) || !has_presence($_POST["tag_subsys"]) || !has_presence($_POST["proposed_till"]) || !has_presence($_POST["loc_mod"]) || !has_presence($_POST["reason_temp_chng"]) || !has_presence($_POST["jumper_desc"])) {
        //mandatory fields are not present
        $_SESSION["error_messages"][] = "All Field Marked * Are Mandatory.";
        $flag = 1;
    }
    if (!preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}\$/", $_POST["proposed_till"])) {
        //Proposed date not of order yyyy-mm-dd
        $_SESSION["error_messages"][] = "Invalid Proposal Date.";
        $flag = 1;
    }
    if (!preg_match("/^[0-9]{1}-[0-9]{2}-[0-9]{2}-[0-9a-zA-Z]{2}-[0-9]{3}\$/", $_POST["dr_no"])) {
        //DR NO. not like 1-15-09-MM-002
        $_SESSION["error_messages"][] = "Invalid DR-No.";
        $flag = 1;
    } else {
        if (check_drno($_POST["dr_no"]) === 0) {
开发者ID:ashk43712,项目名称:Jumper,代码行数:31,代码来源:layout1_edit.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP has_privs函数代码示例发布时间:2022-05-15
下一篇:
PHP has_post_thumbnail函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap