Ec (2); function name: CheckMoney ($ C_Money) & nbsp; function: Check whether the data is in the 99999.99 format & nbsp; & nbsp; parameter: $ C_Money (number to be checked) & nbsp; Return Value: Boolean Value & nbsp; & nbsp; script ec (2); script
// 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 //-----------------------------------------------------------------------------------
-------
| The Code is as follows: |
|
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 //-----------------------------------------------------------------------------------
-------
| The Code is as follows: |
|
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 //-----------------------------------------------------------------------------------
-------
// Function name: CheckWebAddr ($ C_weburl)
// Usage: Determine whether the website is valid
// Parameter: $ C_weburl (URL to be detected)
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
| The Code is as follows: |
|
Function CheckWebAddr ($ C_weburl)
{
If (! Ereg ("^ http: // [_ a-zA-Z0-9-] + (. [_ a-zA-Z0-9-] +) * $", $ C_weburl ))
{
Return false;
}
Return true;
} |
// Configure //-----------------------------------------------------------------------------------
-------
// Configure //-----------------------------------------------------------------------------------
-------
// Function name: CheckEmpty ($ C_char)
// For usage: determines whether the string is null.
// Parameter: $ C_char (string to be detected)
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
| The Code is as follows: |
|
Function CheckEmptyString ($ C_char)
{
If (! Is_string ($ C_char) return false; // whether it is a string type
If (emptyempty ($ C_char) return false; // set
If ($ C_char = '') return false; // whether it is null
Return true;
} |
// Configure //-----------------------------------------------------------------------------------
-------
// Configure //-----------------------------------------------------------------------------------
-------
// Function name: CheckLengthBetween ($ C_char, $ I _len1, $ I _len2 = 100)
// For usage: determines whether the string is within the specified length
// Parameter: $ C_char (string to be detected)
// $ I _len1 (lower limit of the target String Length)
// $ I _len2 (Maximum length of the target string)
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
| The Code is as follows: |
|
Function CheckLengthBetween ($ C_cahr, $ I _len1, $ I _len2 = 100)
{
$ C_cahr = trim ($ C_cahr );
If (strlen ($ C_cahr) <$ I _len1) return false;
If (strlen ($ C_cahr)> $ I _len2) return false;
Return true;
} |
// Configure //-----------------------------------------------------------------------------------
-------
// Configure //-----------------------------------------------------------------------------------
-------
// Function name: CheckUser ($ C_user)
// Usage: determines whether the user name is valid
// Parameter: $ C_user (user name to be detected)
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
| The Code is as follows: |
|
Function CheckUser ($ C_user)
{
If (! CheckLengthBetween ($ C_user, 4, 20) return false; // width check
If (! Ereg ("^ [_ a-zA-Z0-9] * $", $ C_user) return false; // special character check
Return true;
}
|
// Configure //-----------------------------------------------------------------------------------
-------
// Configure //-----------------------------------------------------------------------------------
-------
// Function name: CheckPassword ($ C_passwd)
// Usage: determines whether the password is valid.
// Parameter: $ C_passwd (password to be detected)
// Return value: Boolean
// Standby Note: None
// Configure //-----------------------------------------------------------------------------------
-------
| The Code is as follows: |
|
Function CheckPassword ($ C_passwd)
{
If (! CheckLengthBetween ($ C_passwd, 4, 20) return false; // width Detection
If (! Ereg ("^ [_ a-zA-Z0-9] * $", $ C_passwd) return false; // special character Detection
Return true; |