crypt.php
<?PHPfunctionPkcs5_pad ($text,$blocksize) { $pad=$blocksize- (strlen($text) %$blocksize); return $text.str_repeat(CHR($pad),$pad); } functionMycrypt ($input,$key) { $size= Mcrypt_get_block_size (mcrypt_rijndael_128,MCRYPT_MODE_ECB); $input=pkcs5_pad ($input,$size); $TD= Mcrypt_module_open (mcrypt_rijndael_128, ", MCRYPT_MODE_ECB,"); $iv= Mcrypt_create_iv (Mcrypt_enc_get_iv_size ($TD),Mcrypt_rand); Mcrypt_generic_init ($TD,$key,$iv); $data= Mcrypt_generic ($TD,$input); Mcrypt_generic_deinit ($TD); Mcrypt_module_close ($TD); $data=Base64_encode($data); return $data; } functionMydecrypt ($str,$key) { $decrypted=Mcrypt_decrypt (mcrypt_rijndael_128,$key,Base64_decode($str),MCRYPT_MODE_ECB); $dec _s=strlen($decrypted); $padding=Ord($decrypted[$dec _s-1]); $decrypted=substr($decrypted, 0,-$padding); return $decrypted; }?>
common.php
<?PHP//des encryption Class libraryinclude' Crypt.php ';//Lee Portable Class Libraryinclude' Lee.php ';functionPOST ($get _key) { $str=$_post[$get _key]; returnValidata ($str); }functionGET ($get _key) { $str=$_get[$get _key]; returnValidata ($str); }functionValidata ($str){ //If the value is empty, then an empty string is returned if(!isset($str))return""; //Filtering HTML Tags $farr=Array("/< (\/?) (script|i?frame|style|html|body|title|link|meta|\?| \%) ([^>]*?) >/isu "); //filter Similar <script> <style> <object> <meta> <iframe> etc $str=Preg_replace($farr,"",$str); //precede pre-defined characters such as single and double quotes with backslashes such as ' become ' $str=addslashes($str); //filter Sensitive Words $str=Str_replace(Explode(",", Unsafe_word), "* * *",$str); //return Results return Trim($str);}functionIP () {if(!Empty($_server["Http_client_ip"])){ $cip=$_server["Http_client_ip"]; } ElseIf(!Empty($_server["Http_x_forwarded_for"])){ $cip=$_server["Http_x_forwarded_for"]; } ElseIf(!Empty($_server["REMOTE_ADDR"])){ $cip=$_server["REMOTE_ADDR"]; } Else{ $cip= ""; } return $cip;}functionSet_cache ($key,$value,$expireTime){ $m=NewMemcache (); $m->connect (CACHE_IP,cache_port); $m->set ($key,$value, 0,$expireTime);}functionGet_cache ($key){ $m=NewMemcache (); $m->connect (CACHE_IP,cache_port); return $m->get ($key);}functionLoad_model ($modelName){ return NewModel ($modelName);}functionLoad_lib ($folderName,$touchName){ require_once' library/'.$folderName.‘ /‘.$touchName;}?>
lee.php
<?PHPfunctionEcho_para ($split,$a,$b=0,$c=0,$d=0,$e=0,$f=0,$g=0,$h=0,$i=0,$j=0,$k=0,$l=0,$m=0,$n=0){ //get the total number of parameters $n=Func_num_args(); $str= ""; for($i= 1;$i<$n;$i++) { $str.=Func_get_arg($i) .$split; } return $str;}functionAJAX ($MSG,$Result,$Status){ $arr=Array("MSG" =$MSG, "Result" =$Result, "Status" =$Status); Exit(Json_encode ($arr));}functionWritelog ($msg,$module=NULL,$logLevel= "DEBUG"){ $filepath= "log/"; if(!Is_dir($filepath))mkdir($filepath, ' 0777 '); $MyLogFile= @fopen($filepath.Date("y-m-d"). ". TXT ", ' A + '); $time=Date("Y-m-d h:i:s"); if(isset($module)){$module=sprintf("\ r \ n Attribution module:".)$module." \ r \ n ");} $logLine= "\ r \ n-------------------------------$time-------------------------------\ r \ n "; $logLine.=$module; $logLine. = "\ r \ n Exception information:$msg\ r \ n "; $logLine. = "\ r \ n Error Level:$logLevel\ r \ n "; fwrite($MyLogFile,$logLine);}//WarningfunctionAlert$str){ Echo"<script type= ' text/javascript ' >alert ('".$str."‘) </script> ";}//page Jumpfunctionhref$url){ Echo"<script type= ' text/javascript ' >window.location.href ('".$url."‘) </script> ";}functionSub_ intercepts a string if it exceeds a certain number of ellipses ($str,$num){ if(Mb_strlen ($str) >$num) { $str=substr($str, 0,$num)." ..."; } return $str;}functionMkfolder ($path){ if(!is_readable($path)) { Is_file($path) ormkdir($path); }}?>
PHP Personal Function Library