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


PHP input_validation函数代码示例

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


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

示例1: mysql_real_escape_string

<?php

require_once '../../core/init.php';
//Data Saving Script
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    //echo 'OK';
    $asso_partner_name = mysql_real_escape_string(htmlentities(input_validation($_POST['asso_partner_name'])));
    $asso_partner_details = $_POST['asso_partner_details'];
    $asso_partner_contact = mysql_real_escape_string(htmlentities(input_validation($_POST['asso_partner_contact'])));
    $asso_partner_url = mysql_real_escape_string(htmlentities(input_validation($_POST['asso_partner_url'])));
    @($asso_partner_status = mysql_real_escape_string(htmlentities(input_validation($_POST['asso_partner_status']))));
    @($associate_type_id = mysql_real_escape_string(htmlentities(input_validation($_POST['associate_type_id']))));
    @($allow_log = mysql_real_escape_string(htmlentities(input_validation($_POST['allow_log']))));
    @($asso_partner_id = mysql_real_escape_string(htmlentities(input_validation($_POST['asso_partner_id']))));
    $img = mysql_real_escape_string(htmlentities(strtolower($_FILES["asso_partner_img"]["name"])));
    //$new_img = md5(time()).'_'.$img;
    //query existing img
    $query = $con->prepare("SELECT asso_partner_img FROM associate_partner WHERE asso_partner_id=:asso_partner_id");
    $query->execute(array(':asso_partner_id' => $asso_partner_id));
    $query = $query->fetch(PDO::FETCH_ASSOC);
    $exist_img = $query['asso_partner_img'];
    ///*
    $img_type = $_FILES["asso_partner_img"]["type"];
    $img_size = $_FILES["asso_partner_img"]["size"];
    $img_tmp = $_FILES["asso_partner_img"]["tmp_name"];
    $tmp_size = filesize($_FILES["asso_partner_img"]["tmp_name"]);
    $img_error = $_FILES["asso_partner_img"]["error"];
    define("MAX_SIZE", "1000");
    //Kb
    $allowedExt = array("png", "jpeg", "jpg", "gif");
    //$extension = strtolower (substr ($img, strpos($img, '.') + 1)); // just show the file extension in lowercase
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:associate_partner_form_script.php

示例2: mysql_real_escape_string

<?php

require_once '../../core/init.php';
//check for username availability
/*if(isset($_POST['data'])){
		$username = mysql_real_escape_string(htmlentities(input_validation($_POST['data'])));	
		
		if(!empty($username)){
			if(user_exists_reg($con, $username) === true){
				echo 'Opps, the username \''.$username.'\' is already exist.';
			}
		}
	}*/
//check for email availability
if (isset($_POST['data'])) {
    $email = mysql_real_escape_string(htmlentities(input_validation($_POST['data'])));
    if (!empty($email)) {
        if (email_exists($con, $email) === true) {
            echo 'Opps, the email \'' . $email . '\' is already exist.';
        }
    }
}
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:22,代码来源:availability_check_script.php

示例3: mysql_query

     }
     //end item insert check
 } else {
     //if article_id not empty
     $update = mysql_query("UPDATE article_mst SET\r\n\t\t\t\t\t\t\t\t\t\tart_cat_id='{$art_cat_id}', a_code='{$a_code}', a_title='{$a_title}', a_desc='{$a_desc}',\r\n\t\t\t\t\t\t\t\t\t\ta_comment='{$a_comment}', a_status='{$a_status}', a_pdate='{$a_pdate}', a_mdate=NOW(), a_img='{$exist_img}' \r\n\t\t\t\t\t\t\t\t\t\tWHERE article_id = '{$article_id}'");
     if (!$update) {
         echo "Opps! Data not updated./e";
     } else {
         $delete_join = mysql_query("DELETE FROM article_dtl WHERE article_id = '{$article_id}'");
         if (!$delete_join) {
             echo 'Opps! join data not deleted';
         } else {
             $values = array();
             foreach ($_POST['ad_head'] as $key => $ad_head) {
                 @($ad_head = mysql_real_escape_string(htmlentities(input_validation($ad_head))));
                 $ad_article = mysql_real_escape_string(htmlentities(input_validation($_POST['ad_article'][$key])));
                 $values[] = "('','{$article_id}','{$ad_head}','{$ad_article}','')";
             }
             //$values = implode(',', $values); //print_r($values);
             $join_query = mysql_query("INSERT INTO article_dtl (art_dtl_id, article_id, ad_head, ad_article, ad_img) \r\n\t\t\t\t\t\t\t\t\t\tVALUES " . implode(',', $values));
             if (!$join_query) {
                 echo "Opps! something was wrong for Inserting join table./e";
             } else {
                 //for user log;
                 if ($allow_log == 1) {
                     $remark = 'Article Updated';
                     insert_user_log($con, $_SESSION['user_id'], 5, REMOTE_IP, $remark);
                 }
                 echo "Data was updated Successful!";
             }
         }
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:article_mst_form_script.php

示例4: protect_page

<?php

require_once '../../core/init.php';
protect_page();
only_for_admin($con);
$page_code = 162;
//Fixed Page Code
require_once '../../core/page_setup.php';
//require_once '../script/edit_user_script.php'; //script for member page
if (isset($_GET['log_type_id'])) {
    $log_type_id = mysql_real_escape_string(htmlentities(input_validation($_GET['log_type_id'])));
    $query = $con->prepare("SELECT * FROM log_type WHERE log_type_id=:log_type_id");
    $query->execute(array(':log_type_id' => $log_type_id));
    $result = $query->fetch(PDO::FETCH_ASSOC);
    $log_type_name = $result['log_type_name'];
}
require_once '../../includes/all_header.php';
?>
        
     
    <div id="contents_area">        
    	<div class="form_area" style="width:450px; height:420px;">
        	<div class="control_link_style">
            	<a onclick="clearForm();">Refresh</a>        
            </div>
            
        	<div id="tab_manu">
                <ul id="tabs">
                	<li><a href="#log_type_list_view">List View</a></li>
                    <li><a href="#log_type_add_edit">Log type Add/Edit</a></li>                                          
                </ul>
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:log_type.php

示例5: mysql_real_escape_string

<?php

//require_once '../../core/init.php';
//Data Saving Script
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $name = mysql_real_escape_string(htmlentities(input_validation($_POST['name'])));
    $email = mysql_real_escape_string(htmlentities(input_validation($_POST['email'])));
    $address = mysql_real_escape_string(htmlentities(input_validation($_POST['address'])));
    $city = mysql_real_escape_string(htmlentities(input_validation($_POST['city'])));
    $state = mysql_real_escape_string(htmlentities(input_validation($_POST['state'])));
    $country = mysql_real_escape_string(htmlentities(input_validation($_POST['country'])));
    $phone = mysql_real_escape_string(htmlentities(input_validation($_POST['phone'])));
    $age = mysql_real_escape_string(htmlentities(input_validation($_POST['age'])));
    $hour_per_week = mysql_real_escape_string(htmlentities(input_validation($_POST['hour_per_week'])));
    $about_your_self = mysql_real_escape_string(htmlentities(input_validation($_POST['about_your_self'])));
    if (!empty($name) && !empty($email) && !empty($city)) {
        //echo 'OK';
        //for imput text validation (if some one brack the maxlenght="" attribute in html), i also restricted in HTML input tag (maxlength=""), the maxlenght is the first validation.
        if (strlen($name) > 50) {
            $errors[] = 'Oppos! Max leangth for Name field was excceded.';
        } elseif (strlen($email) > 100) {
            $errors[] = 'Oppos! Max leangth for Email field was excceded.';
        } elseif (strlen($about_your_self) > 1000) {
            $errors[] = 'Oppos! Max leangth for Message field was excceded.';
        } elseif (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $errors[] = 'Your given email \'' . $email . '\' is not valid.';
        } else {
            $to = "rasheed_rabbi@hotmail.com";
            $header = 'Form: hello@servethepeoplebd.org';
            //$header = "Form: contact@edawah.net\r\n";
            //$header .= "Reply-To: ".$email."\r\n";
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:volunteer_locl_form_script.php

示例6: mysql_real_escape_string

    $edit_search_employer_name = mysql_real_escape_string(htmlentities($_POST['edit_search_employer_name']));
    $query = $con->prepare("SELECT u.user_id, u.role, ed.employer_name \r\n\t\t\t\t\t\t\t\t\tFROM user AS u\r\n\t\t\t\t\t\t\t\t\tINNER JOIN employer_dtl AS ed ON u.user_id = ed.user_id\r\n\t\t\t\t\t\t\t\t\tWHERE u.role=:role AND ed.employer_name LIKE :employer_name LIMIT 20 ");
    //u.role=:role AND
    $query->execute(array(':role' => 2, ':employer_name' => '%' . $edit_search_employer_name . '%'));
    //':role'=> 2,
    //$result = $query->fetch(PDO::FETCH_ASSOC);
    while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
        $results[] = $row['employer_name'];
    }
    echo json_encode($results);
    //*/work without this
}
//search for username from email or date_of_birth (dob)
if (isset($_POST['value_edit_search_employer_email']) && isset($_POST['value_edit_search_employer_name'])) {
    $email = mysql_real_escape_string(htmlentities(input_validation($_POST['value_edit_search_employer_email'])));
    $employer_name = mysql_real_escape_string(htmlentities(input_validation($_POST['value_edit_search_employer_name'])));
    $user_id = get_user_id_from_email($con, $email);
    //single item
    if (!empty($email) && empty($employer_name)) {
        $query = $con->prepare("SELECT * FROM user WHERE user_id=:user_id AND role=:role ORDER BY email ASC");
        $query->execute(array(':user_id' => $user_id, ':role' => 2));
    } elseif (empty($email) && !empty($employer_name)) {
        $query = $con->prepare("SELECT u.user_id, u.email, u.role, u.active, u.user_lock, u.allow_email, u.tac, ed.employer_name\r\n\t\t\t\t\t  FROM user AS u\r\n\t\t\t\t\t  INNER JOIN employer_dtl AS ed ON ed.user_id = u.user_id\r\n\t\t\t\t\t  WHERE role=:role AND ed.employer_name LIKE :employer_name ");
        $query->execute(array(':role' => 2, ':employer_name' => '%' . $employer_name . '%'));
    } elseif (!empty($email) && !empty($employer_name)) {
        $query = $con->prepare("SELECT u.user_id, u.email, u.role, u.active, u.user_lock, u.allow_email, u.tac, ed.employer_name\r\n\t\t\t\t\t  FROM user AS u\r\n\t\t\t\t\t  INNER JOIN employer_dtl AS ed ON ed.user_id = u.user_id\r\n\t\t\t\t\t  WHERE u.user_id=:user_id AND role=:role AND ed.employer_name LIKE :employer_name ");
        $query->execute(array(':user_id' => $user_id, ':role' => 2, ':employer_name' => '%' . $employer_name . '%'));
    } elseif (empty($email) && empty($employer_name)) {
        return false;
    }
    echo '<table class="table">
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:search_script--.php

示例7: protect_page

<?php

require_once '../../core/init.php';
protect_page();
only_for_admin($con);
$page_code = 215;
//Fixed Page Code
require_once '../../core/page_setup.php';
//require_once '../script/attrib_sub_cat_manage_script.php';
//get data
if (isset($_GET['i_sub_cat_id'])) {
    $i_sub_cat_id = mysql_real_escape_string(htmlentities(input_validation($_GET['i_sub_cat_id'])));
    /*$query = $con->prepare("SELECT * FROM item_attribute WHERE i_attrib_id=:i_attrib_id");
    		$query->execute(array(':i_attrib_id'=>$i_attrib_id));
    		$result = $query->fetch(PDO::FETCH_ASSOC);		
    			$attribute_name = $result['attribute_name'];	*/
}
require_once '../../includes/all_header.php';
?>
        
     
    <div id="contents_area">        
        <div class="form_area" style="width:800px; height:430px;">
        	<div class="control_link_style">
            	<a onclick="clearForm();">Refresh</a>        
            </div>
        
        	<div id="tab_manu">
                <ul id="tabs">
                    <li><a href="#list_view">List View</a></li>
                    <li><a href="#add_edit_attrib_sub_cat_manage">Attrib & Sub-category management</a></li>                      
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:attrib_sub_cat_manage.php

示例8: Society

$society = new Society();
# We print the societies
$society->print_all_society($connection);
?>
			</div>
			
			<!-- Get details about society -->
			<div id="singlesociety">
				<h3>Find details about a society</h3>
				<form action="" method="post">
					<input type="text" name="onesociety"/>					
					<input type="submit" name="singlesociety"/>					
				</form>
				<?php 
// activate function to get values from the form and validates the values
$validated_array = input_validation();
##################################
# this is for development only
# print_r($validated_array);
# die;
################################
# Print details about selected society
# We test if we got result from the $_POST['onesociety']
if (!empty($validated_array['onesociety'])) {
    $society->get_details_about_selected_society($connection, $validated_array['onesociety']);
}
?>
			</div> <!-- END <div id="singlesociety">  -->
				
			<!-- Shows the families in one society -->	
			<div id="familiesbysociety">
开发者ID:natanshalva,项目名称:php-project,代码行数:31,代码来源:index.php

示例9: set_post_num_list

function set_post_num_list($varname)
{
    if (!isset($_POST[$varname]) || $_POST[$varname] == '') {
        $return = array();
    } else {
        $return = set_num_array(explode("_", $_POST[$varname]));
    }
    return input_validation($return);
}
开发者ID:roxine9,项目名称:online-bookmarks,代码行数:9,代码来源:lib.php

示例10: input_validation

        $email = input_validation($_POST["email"]);
    }
    if (empty($_POST["password"])) {
        $passwordErr = "Password is required!!!";
        $EmptyErr = true;
    } else {
        $password = input_validation($_POST["password"]);
    }
    if (empty($_POST["confrmpassword"])) {
        $confrmpasswordErr = "Please confirm your password!!!";
        $EmptyErr = true;
    } elseif ($_POST["confrmpassword"] != $password) {
        $confrmpasswordErr = "Your password is not correctly confirmed!!!";
        $passwordconfrmErr = true;
    } else {
        $confrmpassword = input_validation($_POST["confrmpassword"]);
    }
}
function input_validation($input)
{
    $input = trim($input);
    $input = stripcslashes($input);
    $input = htmlspecialchars($input);
    return $input;
}
?>
	
		<form method = "post" action = "register_mysql.php">
			* required
			<br><br>
			Username:<input type = "text" name = "username" value = "<?php 
开发者ID:shawncxc,项目名称:MeetYa-Social-Web-demo,代码行数:31,代码来源:register.php

示例11: elseif

    $i_user_type_id = $item_query['i_user_type_id'];
    $i_img = $item_query['i_img'];
    //query category and sub-category of item
    $item_sub_cat_query = $con->prepare("SELECT isc.i_sub_cat_id, isc.i_cat_id\r\n\t\t\t\t\t\t\t\tFROM item_sub_category AS isc\r\n\t\t\t\t\t\t\t\tINNER JOIN j_item_sub_cat AS jisc ON jisc.i_sub_cat_id = isc.i_sub_cat_id\r\n\t\t\t\t\t\t\t\tWHERE jisc.item_id=:item_id");
    $item_sub_cat_query->execute(array(':item_id' => $item_id));
    $item_sub_cat_query = $item_sub_cat_query->fetch(PDO::FETCH_ASSOC);
    $i_sub_cat_id = $item_sub_cat_query['i_sub_cat_id'];
    //sub-category
    $i_cat_id = $item_sub_cat_query['i_cat_id'];
    //category
    //query item attribute based on sub-category
    $item_attrib_value_query = $con->prepare("SELECT jiav.i_attrib_id, jiav.attribe_value, jiav.attribe_sirial, ia.attribute_name\r\n\t\t\t\t\t\t\t\tFROM j_item_attrib_value AS jiav\r\n\t\t\t\t\t\t\t\tINNER JOIN item_attribute AS ia ON ia.i_attrib_id = jiav.i_attrib_id\r\n\t\t\t\t\t\t\t\tWHERE jiav.item_id=:item_id");
    $item_attrib_value_query->execute(array(':item_id' => $item_id));
    //$item_attrib_value_query = $item_attrib_value_query->fetch(PDO::FETCH_ASSOC);
} elseif (isset($_SESSION['session_item_id'])) {
    @($item_id = mysql_real_escape_string(htmlentities(input_validation($_SESSION['session_item_id']))));
    //query item
    $item_query = $con->prepare("SELECT * FROM item_mst WHERE item_id=:item_id");
    $item_query->execute(array(':item_id' => $item_id));
    $item_query = $item_query->fetch(PDO::FETCH_ASSOC);
    $i_code = $item_query['i_code'];
    $i_name = $item_query['i_name'];
    $i_details = $item_query['i_details'];
    $i_available = $item_query['i_available'];
    $i_price = $item_query['i_price'];
    $i_quantity = $item_query['i_quantity'];
    $brand_id = $item_query['brand_id'];
    $i_user_type_id = $item_query['i_user_type_id'];
    $i_img = $item_query['i_img'];
    //query category and sub-category of item
    $item_sub_cat_query = $con->prepare("SELECT isc.i_sub_cat_id, isc.i_cat_id\r\n\t\t\t\t\t\t\t\tFROM item_sub_category AS isc\r\n\t\t\t\t\t\t\t\tINNER JOIN j_item_sub_cat AS jisc ON jisc.i_sub_cat_id = isc.i_sub_cat_id\r\n\t\t\t\t\t\t\t\tWHERE jisc.item_id=:item_id");
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:item_mst_script.php

示例12: date_default_timezone_set

date_default_timezone_set('Etc/UTC');
/***
* Cleans email input to prevent spam, etc.
* @param 	$formData 	input date from HTML form
* @return 	trimed, stripped and html special chars removed
*/
function input_validation($formData)
{
    $formData = trim($formData);
    $formData = stripslashes($formData);
    $formData = htmlspecialchars($formData);
    return $formData;
}
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$firstName = input_validation($request->firstName);
$lastName = input_validation($request->lastName);
$email = input_validation($request->email);
$phone = input_validation($request->phoneNumber);
$message = wordwrap("Email from: " . $firstName . " " . $lastName . "<" . $email . ">\r\n" . "Phone: " . $phone . "\r\nMessage:\r\n" . input_validation($request->message), 70, "\r\n");
// $headers = "MIME-Version: 1.0" . "\r\n";
// $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers = "From: <" . $email . ">" . "\r\n";
$headers .= "Reply-to: " . $email . "\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
if (mail("krisjbyrum@gmail.com", "Message from Portfolio Website", $message)) {
    echo "Successful sending";
} else {
    echo "Sorry. Something went wrong.";
}
return;
开发者ID:KrisB1022,项目名称:Portfolio_NEW,代码行数:31,代码来源:contact.php

示例13: mysql_real_escape_string

<?php

require_once '../../core/init.php';
//Delete User from edit_user form
if (isset($_POST['delete_user_id'])) {
    //if(isset($_POST['term'])){ //where 'term' is the default keyword in jquery autocomplete api
    $delete_user_id = mysql_real_escape_string(htmlentities(input_validation($_POST['delete_user_id'])));
    //use for get role and also log
    $query = $con->prepare("SELECT email, role FROM user WHERE user_id=:user_id");
    $query->execute(array(':user_id' => $delete_user_id));
    $result = $query->fetch(PDO::FETCH_ASSOC);
    $get_email = $result['email'];
    $get_role = $result['role'];
    if (!empty($get_email)) {
        //delete query
        $delete = $con->prepare("DELETE FROM user where user_id=:user_id");
        $delete = $delete->execute(array(':user_id' => $delete_user_id));
        if ($delete) {
            if ($get_role == 1) {
                $query = $con->prepare("SELECT admin_img FROM admin_dtl WHERE user_id=:user_id");
                $query->execute(array(':user_id' => $delete_user_id));
                $result = $query->fetch(PDO::FETCH_ASSOC);
                $get_img = $result['admin_img'];
                if ($get_img) {
                    @unlink('../../files/profile/' . $get_img);
                    //delete img
                    $delete_dtl = $con->prepare("DELETE FROM admin_dtl where user_id=:user_id");
                    $delete_dtl->execute(array(':user_id' => $delete_user_id));
                }
            } elseif ($get_role == 2) {
                $query = $con->prepare("SELECT employer_img FROM employer_dtl WHERE user_id=:user_id");
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:delete_script.php

示例14: mysql_real_escape_string

<?php

require_once '../../core/init.php';
//Data Saving Script
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    //echo 'OK';
    $p_code = mysql_real_escape_string(htmlentities(input_validation($_POST['p_code'])));
    $page_name = mysql_real_escape_string(htmlentities(input_validation($_POST['page_name'])));
    $title = mysql_real_escape_string(htmlentities(input_validation($_POST['title'])));
    $keywords = mysql_real_escape_string(htmlentities(input_validation($_POST['keywords'])));
    $page_desc = mysql_real_escape_string(htmlentities(input_validation($_POST['page_desc'])));
    @($allow_log_value = mysql_real_escape_string(htmlentities(input_validation($_POST['allow_log_value']))));
    @($allow_log = mysql_real_escape_string(htmlentities(input_validation($_POST['allow_log']))));
    @($page_id = mysql_real_escape_string(htmlentities(input_validation($_POST['page_id']))));
    if (!empty($page_name) && !empty($title) && !empty($p_code)) {
        if (empty($page_id)) {
            $insert = mysql_query("INSERT INTO page_setup VALUES ('','{$p_code}','{$page_name}','{$title}','{$keywords}','{$page_desc}', '{$allow_log_value}')");
            $last_insert_id = mysql_insert_id();
            if (!$insert) {
                echo "Opps! Data not inserted./e";
            } else {
                //for user log;
                if ($allow_log == 1) {
                    $remark = 'Page Information added for \'' . display_page_name_from_page_id($con, $last_insert_id) . '\'.';
                    insert_user_log($con, $_SESSION['user_id'], 4, REMOTE_IP, $remark);
                }
                echo "Data was inserted Successful!";
            }
        } else {
            $update = mysql_query("UPDATE page_setup SET p_code='{$p_code}', page_desc='{$page_desc}', page_name = '{$page_name}', \r\n\t\t\t\t\t\t\t\t\t\ttitle = '{$title}', keywords='{$keywords}', allow_log='{$allow_log_value}' \r\n\t\t\t\t\t\t\t\t\t\tWHERE page_id  = '{$page_id}'");
            if (!$update) {
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:config_page_form_script.php

示例15: mysql_real_escape_string

<?php

//require_once '../../core/init.php'; //not use for this action without jquery
// Login Script (function use from user.php)
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $username = mysql_real_escape_string(htmlentities(input_validation($_POST['username'])));
    //@$pin = mysql_real_escape_string(htmlentities(input_validation($_POST['pin'])));
    $password = mysql_real_escape_string(htmlentities(input_validation($_POST['password'])));
    $password_md5 = md5($password);
    @($remember_me = mysql_real_escape_string(htmlentities(input_validation($_POST['remember_me']))));
    if (!empty($username) && !empty($password)) {
        if (user_exists($con, $username) === false) {
            //$con is PDO connection variable
            $errors[] = 'We can\'t find your Username';
        } elseif (user_active($con, $username, $password_md5) === false) {
            //echo 'You haven\'t activated your account.';
            $errors[] = 'Your account isn\'t active. Please contact with administrator.';
        } elseif (user_lock($con, $username, $password_md5) === false) {
            //echo 'You account is Locked, Please contact with admin.';
            $errors[] = 'You account is Locked, Please contact with administrator.';
        } else {
            $login = login($con, $username, $password_md5);
            if ($login === false) {
                //if login return false
                //echo 'Your Username / Password combination is incorrect.';
                $errors[] = 'Your Username / Password combination is incorrect.';
            } else {
                $_SESSION['user_id'] = $login;
                session_regenerate_id();
                //creates a new unique-ID for to represent the current user’s session.
                //for login user log;
开发者ID:rrabbi,项目名称:servethepeoplebd,代码行数:31,代码来源:login_script.php


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