*
String check class
* @ Author sanshi
QQ: 35047205
Email: sanshi0815@tom.com
MSN: sanshi0815@tom.com
*/
Class checkBase
{
Function checkBase ()
{
}
/*
Used to check whether the string is null
* @ Param $ str check field
* @ Param $ isStr if the field may have unique characters of the number or bool type
Returns true if it is null.
*/
Function strIsNull ($ str, $ isStr = true)
{
Return $ isStr? (Empty ($ str )? True: false)
:( Isset ($ str )? False: true );
}
/*
Comparison between string and Regular Expression
@ Param $ str string to be compared
@ Param $ regular expression to be compared with pattern
Returns true when compared with the regular expression.
*/
Function strComparePattern ($ str, $ pattern)
{
If (ereg ($ pattern, $ str ))
{
// Return is found
Return true;
}
Return false;
}
/*
Judge the length of a string
@ Param $ str the string to be checked
@ Param $ max maximum length
@ Param $ min minimum length
Returns true if it meets the requirements.
*/
Function strCompareLen ($ str, $ max, $ min = 1)
{
$ Len = strlen ($ str );
$ Max = empty ($ max )? $ Len: $ max;
Return ($ len> $ max | $ len <$ min )? False: true;
}
/*
Information processing, jump to the page
@ Param $ page the page to jump
@ Param $ msg prompt information
*/
Function msg ($ page, $ msg)
{
$ Msg = empty ($ msg )? '''''''':"? Msg = ". base64_encode ($ msg );
$ Url = $ page. $ msg;
If (@ header ("Location:". $ url ))
{
Echo "<meta http-equiv = refresh content = ''' 0; url =". $ url. "'''> ";
}
Exit ();
}
}