Php universal detection function set (1) _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Php universal detection function set (1 ). ※Checkmoney ($ C_Money): Check whether the data is in the 99999.99 format. ※checkemailaddr ($ C_mailaddr): Check whether the data is in a valid email address. ※checkwebaddr ($ C_weburl) determine whether it is a valid network // ※checkmoney ($ C_Money) check whether the data is in the 99999.99 format
// ※Checkemailaddr ($ C_mailaddr) determines whether the email address is valid.
// ※Checkwebaddr ($ C_weburl)
// ※Checkempty ($ C_char) determines whether the string is null.
// ※Checklengthbetween ($ C_char, $ I _len1, $ I _len2 = 100)
// ※Checkuser ($ C_user) determines whether the user name is valid.
// ※Checkpassword ($ C_passwd) determines whether the password is valid.
// ※Checktelephone ($ C_telephone)
// ※Checkvaluebetween ($ N_var, $ N_val1, $ N_val2) determines whether the value is valid within a certain range.
// ※Checkpost ($ C_post) determines whether the postal code is valid (fixed length)
// ※Checkextendname ($ C_filename, $ A_extend) indicates the extension of the uploaded file.
// ※Checkimagesize ($ ImageFileName, $ LimitSize) indicates the size of the uploaded image.
// ※Alertexit ($ C_alert, $ I _goback = 0) indicates an invalid operation and exits.
// ※Alert ($ C_alert, $ I _goback = 0) indicates an invalid operation warning.
// ※Replacespacialchar ($ C_char) special character replacement function
// ※Exchangemoney ($ N_money) fund conversion function
// ※Windowlocation ($ C_url, $ C_get = "", $ C_getOther = "") function of window. location in PHP
// Configure //-----------------------------------------------------------------------------------
-------


// Configure //-----------------------------------------------------------------------------------
-------
// Function name: CheckMoney ($ C_Money)
// For usage: Check whether the data is in the 99999.99 format
// Parameter: $ C_Money (number to be detected)
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
Function CheckMoney ($ C_Money)
{
If (! Ereg ("^ [0-9] [.] [0-9] $", $ C_Money) return false;
Return true;
}
// Configure //-----------------------------------------------------------------------------------
-------


// Configure //-----------------------------------------------------------------------------------
-------
// Function name: CheckEmailAddr ($ C_mailaddr)
// Usage: determines whether the email address is a valid email address.
// Parameter: $ C_mailaddr (email address to be detected)
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
Function CheckEmailAddr ($ C_mailaddr)
{
If (! Eregi ("^ [_ a-z0-9-] + (. [_ a-z0-9-] +) * @ [a-z0-9-] + (. [a-z0-9-] +) * $ ",
$ C_mailaddr ))
//(! Ereg ("^ [_ a-zA-Z0-9-] + (. [_ a-zA-Z0-9-] +) * @ [_ a-zA-Z0-9-] + (. [_ a-zA-Z0-9-] +) * $ ",
$ C_mailaddr ))
{
Return false;
}
Return true;
}
// Configure //-----------------------------------------------------------------------------------
-------


// Configure //-----------------------------------------------------------------------------------
-------

Http://www.bkjia.com/PHPjc/532632.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/532632.htmlTechArticle// ※checkmoney ($ C_Money) check whether the data is in 99999.99 format // ※checkemailaddr ($ C_mailaddr) check whether it is a valid email address // ※checkwebaddr ($ C_weburl) determine whether the network is valid...

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.