The following are the referenced contents: //※checkmoney ($C _money) checks whether the data is in 99999.99 format //※checkemailaddr ($C _mailaddr) to determine if it is a valid mail address //※checkwebaddr ($C _weburl) to determine whether a valid URL //※checkempty ($C _char) determines whether the string is empty //※checklengthbetween ($C _char, $I _len1, $I _len2=100) Determines whether the string //※checkuser ($C _user) in the specified length is judged to be a legal user name //※checkpassword ($C _passwd) to determine if the password is legitimate user //※ Checktelephone ($C _telephone) determines whether the legal phone number //※checkvaluebetween ($N _var, $N _val1, $N _val2) determines whether it is a range of legitimate values //※ Checkpost ($C _post) to determine whether the file is valid (fixed-length) //※checkextendname ($C _filename, $A _extend) to determine the extension of the uploaded files //※checkimagesize ( $ImageFileName, $LimitSize) Check the size of the uploaded picture //※alertexit ($C _alert, $I _goback=0) Illegal operation warning and exit //※alert ($C _alert, $I _ goback=0) Illegal Operation warning //※replacespacialchar ($C _char) special character replacement function //※exchangemoney ($N _money) capital conversion function //※ Windowlocation ($C _url, $C _get= "", $C _getother= "") window.location function in PHP //----------------------------------- ------------------------------------------------ ------- //----------------------------------------------------------------------------------- ------- //function name: Check Money ($C _money) //function: Check if data is 99999.99 format //parameter: $C _money (number to be detected) //Return value: Boolean //Memo: No //--------------- --------------------------------------------------------------------the ------- function Checkmoney ($C _money { if (!ereg ("^[0-9][.] [0-9]$ ", $C _money)) return false; return true; } //----------------------------------------------------------------------------------- ------- //----------------------------------------------------------------------------------- ------- //function name: Check EMAILADDR ($C _mailaddr) //function: To determine if it is a valid mailing address //parameter: $C _mailaddr (email address to be detected) //Return value: Boolean //Memo: None //--------- -------------------------------------------------------------------------- ------- 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; } //----------------------------------------------------------------------------------- ------- //----------------------------------------------------------------------------------- ------- //function name: Check WEBADDR ($C _weburl) //function: To determine if it is a valid URL //parameter: $C _weburl (address to be detected) //Return value: Boolean //Memo: No //------------------- ---------------------------------------------------------------- ------- Function checkwebaddr ($C _weburl) { if (!ereg () ^http://[_a-za-z0-9-]+ (. [ _a-za-z0-9-]+) *$ ", $C _weburl)) { return false; } return true; } //----------------------------------------------------------------------------------- ------- //----------------------------------------------------------------------------------- ------- //function name: Check Empty ($C _char) //function: To determine whether the string is empty //parameter: $C _char (the string to be detected) //Return value: Boolean //Memo: No //------------------------ ----------------------------------------------------------- ------- Function checkemptystring ($C _char) { if (!is_string ($C _char)) return false;/whether it is a string type if (empty _char)) return false;/is set if ($C _char= = ') return false; Is null return true; } //----------------------------------------------------------------------------------- ------- //----------------------------------------------------------------------------------- ------- //function name: Checkleng Thbetween ($C _char, $I _len1, $I _len2=100) //function: To determine whether a string within a specified length //parameter: $C _char (the string to be detected) //$I _len1 (lower bound of the target string length) //$I _len2 (upper bound of target string length) //Return value: Boolean //Memo: None //-------------------------------------------------------- --------------------------- ------- 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; } //----------------------------------------------------------------------------------- ------- //----------------------------------------------------------------------------------- ------- //function name: CheckUser ($C _user) //function: To determine whether the legal user name //parameter: $C _user (user name to be detected) //Return value: Boolean //Memo: None //------------------------------------- ---------------------------------------------- ------- Function CheckUser ($C _user) { if (! Checklengthbetween ($C _user, 4)) return false; Width Check if (!ereg ("^[_a-za-z0-9]*$", $C _user)) return false;//special character validation return true; } //----------------------------------------------------------------------------------- ------- //----------------------------------------------------------------------------------- ------- Function name: Checkpassword ($C _passwd) Role: Determine if the password is a legitimate user Parameters: $C _passwd (password to be detected) Return Value: Boolean value Note: none //----------------------------------------------------------------------------------- ------- function Checkpassword ($C _passwd) { if (! Checklengthbetween ($C _passwd, 4)) return false; Width detection if (!ereg ("^[_a-za-z0-9]*$", $C _passwd)) return false; Special character detection return true; }
|