<? Php
/**
* @ Name date safe class 0.1
* @ Author kevin xu
* @ Copyright kenvin E-mail: gincn@cn.cashboxparty.com MSN: gincn@live.cn
*/
Interface dateSafe {
Function gincn ();
}
Class safe extends doSafe implements dateSafe
{
Public $ safe;
Function _ construct ($ safe)
{
Parent: :__ construct ($ safe); // call the parent class constructor. The error is returned by javachen.
$ This-> safe = $ safe;
}
Function gincn ()
{
$ This-> safe = parent: xss ($ this-> safe );
$ This-> safe = parent: SQL ($ this-> safe );
Return $ this-> safe;
}
}
Class doSafe
{
Protected $ str;
Function _ construct ($ str)
{
$ This-> str = $ str;
}
Function xss ()
{
$ This-> str = trim ($ this-> str); // clear space characters
$ This-> str = nl2br ($ this-> str); // convert the linefeed to <br/>
$ This-> str = strip_tags ($ this-> str); // filter HTML tags in text
$ This-> str = htmlspecialchars ($ this-> str); // converts the content in the text to an HTML Entity
$ This-> str = addslashes ($ this-> str); // Add character escaping
Return $ this-> str;
}
Function SQL ()
{
$ This-> str = mysql_escape_string ($ this-> str );
Return $ this-> str;
}
}
?>