PHP Common authentication Method ____php

Source: Internet
Author: User
   is an empty function isempt ($str) {$bool =false; if ($str = = ' | | $str ==null| |
        Empty ($STR)) && (!is_numeric ($STR))) $bool =true;
    return $bool;
        }//Whether contains function contain ($STR, $a) {$bool =false;
            if (!isempt ($a) &&!isempt ($str)) {$ad =strpos ($str, $a); if ($ad >0| |!
        Is_bool ($ad)) $bool =true;
    return $bool; }//Is Ajax function Isajax () {if (Isset ($_server[' Http_x_requested_with ')) && Strtolower
        ($_server[' http_x_requested_with ') = = ' XMLHttpRequest ') {return true;
        }else{return false;
    };
		//Whether the mailbox Public function Isemail ($STR) {if (Isempt ($STR)) is return false;
	Return Filter_var ($str, Filter_validate_email);
		//Whether the mobile phone number public function IsMobile ($STR) {if (Isempt ($STR)) is return false;
		if (!is_numeric ($str) | | | strlen ($STR)!=11) return false;
	return true; //Whether there is a Chinese public function ISINCN ($str) {return Preg_match ("/[\x7f-\xff]/", $str);
		//Whether the entire English a-z,0-9 public function Iszgen ($STR) {if (isempt)) is return false;
		if ($this->ISINCN ($str)) {return false;
	return true; //return string encoding Public function Getencode ($str) {$encode = mb_detect_encoding ($str, Array (' ASCII ', ' UTF-8 ', ' GB2312 ', ' GB
		K ', ' BIG5 '));
		$encode = Strtolower ($encode);
	return $encode;
		//Whether the number public function Isnumber ($STR) {if (Isempt ($STR)) is return false;
	Return Is_numeric ($STR); }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.