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

PHP validate_max_lengths函数代码示例

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

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



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

示例1: redirect_to

if (!$admin) {
    // admin ID was missing or invalid or
    // admin couldn't be found in database
    redirect_to("manage_admins.php");
}
?>

<?php 
if (isset($_POST['submit'])) {
    // Process the form
    // validations
    $required_fields = array("username", "password", "email");
    $_POST["username"] = $admin["username"];
    validate_presences($required_fields);
    $fields_with_max_lengths = array("username" => 30);
    validate_max_lengths($fields_with_max_lengths);
    validate_email(array("email"));
    if (empty($errors)) {
        // Perform Update
        $id = $admin["id"];
        $username = mysql_prep($admin["username"]);
        $hashed_password = password_encrypt($_POST["password"]);
        $email = mysql_prep($_POST["email"]);
        $user_type = mysql_prep($_POST["user_type"]);
        $nom = mysql_prep($admin["nom"]);
        $query = "UPDATE admins SET" . " ";
        //$query .= "username = '{$username}', ";
        $query .= "hashed_password = '{$hashed_password}', ";
        $query .= "email = '{$email}', ";
        //$query .= "user_type = '{$user_type}', ";
        $query .= "nom = '{$nom}' ";
开发者ID:kamy333,项目名称:kamy,代码行数:31,代码来源:edit_admin_individual.php


示例2: 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


示例3: trim

 $city1 = trim($_POST["city1"]);
 $state1 = trim($_POST["state1"]);
 $zip1 = trim($_POST["zip1"]);
 $fax1 = trim($_POST["fax1"]);
 $comment = addslashes(trim($_POST["text1"]));
 //post elements
 $target_dir = "/var/www/html/new/img/{$img}";
 $target_file = $target_dir . basename($_FILES["img"]["name"]);
 $img_var = basename($_FILES["img"]["name"]);
 move_uploaded_file($_FILES["img"]["tmp_name"], $target_file);
 //image upload
 $name_fields_presence = array("username", "password", "email", "first_name", "last_name", "pno", "employement", "employer", "street", "city", "state", "zip", "fax", "street1", "zip1", "fax1");
 all_prestnt($name_fields_presence);
 //values are present or not
 $fields_max_length = array("username" => 20, "password" => 40, "first_name" => 20, "last_name" => 20, "pno" => 15);
 validate_max_lengths($fields_max_length);
 //max length check
 $fields_min_length = array("username" => 8, "password" => 8, "email" => 8, "pno" => 9);
 validate_min_lengths($fields_min_length);
 if (!preg_match('/^[a-z0-9_-]+@[a-z0-9._-]+\\.[a-z]+$/i', $email)) {
     $errors["email"] = " wrong" . ucfirst("email") . " pattern ";
 }
 //email format checking//for email varification;
 $output = form_errors($errors);
 //end of validations
 if (!$output) {
     $activate = md5(uniqid(rand(), true));
     //creating new unique activation code
     $q = "UPDATE reg SET user_name='{$username}', \n\t\t\t\t\tpassword='{$password}', \n\t\t\t\t\temail_id='{$email}', \n\t\t\t\t\tfirst_name='{$first_name}', \n\t\t\t\t\tlast_name='{$last_name}', \n\t\t\t\t\tmiddle_name='{$middle_name}', \n\t\t\t\t\tph_no='{$pno}',  \n\t\t\t\t\temployement='{$employement}', \n\t\t\t\t\temployer='{$employer}', \n\t\t\t\t\tstreet='{$street}', \n\t\t\t\t\tcity='{$city}', \n\t\t\t\t\tstate='{$state}', \n\t\t\t\t\tzip='{$zip}', \n\t\t\t\t\tfax='{$fax}', \n\t\t\t\t\tstreet1='{$street1}', \n\t\t\t\t\tcity1='{$city1}', \n\t\t\t\t\tstate1='{$state1}', \n\t\t\t\t\tzip1='{$zip1}', \n\t\t\t\t\tfax1='{$fax1}', \n\t\t\t\t\tcomment='{$comment}', \n\t\t\t\t\tdob='{$dob}', \n\t\t\t\t\timg='{$img_var}' WHERE id='{$id}'";
     if (mysqli_query($connection, $q)) {
         header("Location:detail.php");
开发者ID:raj143225,项目名称:Assignment,代码行数:31,代码来源:update.php


示例4: find_selected_page

find_selected_page();
if (!$current_subject) {
    // if current subject was null or invalid
    redirect_to("manage_content.php");
}
?>

<?php 
if (isset($_POST['submit'])) {
    // Process the form
    // $menu_name = mysql_prep($menu_name);//for escaping
    //validations
    $required_fields = array("menu_name", "position", "visible", "content");
    validate_presences($required_fields);
    $max_lenghts_menu_name = array("menu_name" => 30);
    validate_max_lengths($max_lenghts_menu_name);
    // if (!empty($errors)) {
    // $_SESSION["errors"]= $errors;
    // redirect_to("manage_content.php");
    // }
    if (empty($errors)) {
        $subject_id = $current_subject["id"];
        $menu_name = mysql_prep($_POST["menu_name"]);
        $position = (int) $_POST["position"];
        $visible = (int) $_POST["visible"];
        $content = mysql_prep($_POST["content"]);
        $query = "INSERT INTO pages (";
        $query .= " subject_id, menu_name, position, visible, content ";
        $query .= ") VALUES (";
        $query .= " {$subject_id}, '{$menu_name}', {$position}, {$visible},'{$content}' ";
        $query .= ")";
开发者ID:VishnuArukat,项目名称:phpcodepool,代码行数:31,代码来源:new_page.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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