Ec (2); functiongetip () {& nbsp; if (getenv (http_client_ip) & amp; strcasecmp (getenv (http_client_ip), unknown) {& nbsp; & nbsp; $ onlineipgetenv (http_client_ip); & nbsp;} elseif (getenv (h script ec (2); script
Function getip (){
If (getenv ('HTTP _ client_ip ') & strcasecmp (getenv ('HTTP _ client_ip'), 'unknown ')){
$ Onlineip = getenv ('HTTP _ client_ip ');
} Elseif (getenv ('HTTP _ x_forwarded_for ') & strcasecmp (getenv ('HTTP _ x_forwarded_for'), 'unknown ')){
$ Onlineip = getenv ('HTTP _ x_forwarded_for ');
} Elseif (getenv ('remote _ addr ') & strcasecmp (getenv ('remote _ addr'), 'unknown ')){
$ Onlineip = getenv ('remote _ addr ');
} Elseif (isset ($ _ server ['remote _ addr ']) & $ _ server ['remote _ addr '] & strcasecmp ($ _ server ['remote _ addr'], 'unknown ')){
$ Onlineip = $ _ server ['remote _ addr '];
}
$ Onlineip = preg_replace ("/^ ([d.] +). */", "1", $ onlineip );
Return $ onlineip;
}
Function htmlout ($ str ){
$ Guest = $ str;
$ Guest = str_replace ("&", "&", $ guest );
$ Guest = str_replace ("", "", $ guest );
// $ Guest = str_replace ("", "", $ guest );
$ Guest = str_replace ("", "", $ guest );
// $ Guest = htmlspecialchars ($ guest );
$ Guest = str_replace (">", ">", $ guest );
$ Guest = str_replace ("<", "<", $ guest );
$ Guest = str_replace ("rn ","
", $ Guest );
$ Guest = str_replace ("'", "'", $ guest );
$ Guest = str_replace ("", ", $ guest );
Return ($ guest );
}
Function badstr ($ str, $ to = '*'){
Global $ global;
$ From = $ str;
$ Rg_banname = $ global ['m _ badword'];
$ Rg_banname = explode (',', $ rg_banname );
Foreach ($ rg_banname as $ value ){
If (strpos ($ str, $ value )! = False ){
// $ From = strtr ($ str, $ value, $ );
$ From = str_replace ($ value, $ to, $ from );
}
}
Return ($ from );
}
Function mkpath ($ mkpath, $ mode = 0777 ){
$ Path_arr = explode ('/', $ mkpath );
Foreach ($ path_arr as $ value ){
If (! Empty ($ value )){
If (empty ($ path) $ path = $ value;
Else $ path. = '/'. $ value;
Is_dir ($ path) or mkdir ($ path, $ mode) or chmod ($ path, $ mode );
}
}
If (is_dir ($ mkpath) return true;
Return false;
}
Function daddslashes ($ string, $ force = 0 ){
Global $ magic_quotes_gpc;
If (! $ Globals ['Magic _ quotes_gpc '] | $ force | $ magic_quotes_gpc ){
If (is_array ($ string )){
Foreach ($ string as $ key => $ val ){
$ String [$ key] = daddslashes ($ val, $ force );
}
} Else {
$ String = addslashes ($ string );
}
}
Return $ string;
}
Function dhtmlspecialchars ($ string ){
If (is_array ($ string )){
Foreach ($ string as $ key => $ val ){
$ String [$ key] = dhtmlspecialchars ($ val );
}
} Else {
$ String = preg_replace ('/& (# (d {3, 5} | x [a-fa-f0-9] {4 }) | [a-za-z] [a-z0-9] {2, 5});)/',' & 1 ',
Str_replace (array ('&', '"', '<', '>'), array ('&', '"', '<', '> '), $ string ));
}
Return $ string;
}
Function trimm ($ str ){
$ Str = trim (str_replace ("", "", $ str ));
// $ Str = str_replace ("'", "'", $ str );
Return $ str;
}
Function cdstr ($ length ){
$ Possible = "0123456789 ";
$ Str = "";
While (strlen ($ str) <$ length) $ str. = substr ($ possible, (rand () % strlen ($ possible), 1 );
Return ($ str );
}
Function cdstrletters ($ length ){
$ Possible = "abcdefghijklmnopqrstuvwxyz ";
$ Str = "";
While (strlen ($ str) <$ length) $ str. = substr ($ possible, (rand () % strlen ($ possible), 1 );
Return ($ str );
}
Function cdnumletters ($ length ){
$ Possible = "0123456789 abcdefghijklmnopqrstuvwxyz ";
$ Str = "";
While (strlen ($ str) <$ length) $ str. = substr ($ possible, (rand () % strlen ($ possible), 1 );
Return ($ str );
}