A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Untitled - Stikked
From Innocent Elephant, 5 Years ago, written in PHP.
Embed
  1. <?php
  2. defined('IN_TS') or die('Access Denied.');
  3. //加密解密函数
  4. class  crypt{
  5.  
  6.         protected $key = "";    //公钥
  7.  
  8.         private function keyED($txt,$encrypt_key) {
  9.                 $encrypt_key = md5($encrypt_key);
  10.                 $ctr=0;
  11.                 $tmp = "";
  12.                 for ($i=0;$i<strlen($txt);$i++) {
  13.                         if ($ctr==strlen($encrypt_key)){
  14.                                 $ctr=0;
  15.                         }
  16.                         $tmp.= substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1);
  17.                         $ctr++;
  18.                 }
  19.                 return $tmp;
  20.         }
  21.  
  22.         public function encrypt($txt,$key="") {
  23.                 if(empty($key)){
  24.                         $key=$this->key;
  25.                 }
  26.                 srand((double)microtime()*1000000);
  27.                 $encrypt_key = md5(rand(0,32000));
  28.                 $ctr=0;
  29.                 $tmp = "";
  30.                 for ($i=0;$i<strlen($txt);$i++) {
  31.                         if ($ctr==strlen($encrypt_key)){
  32.                                 $ctr=0;
  33.                         }
  34.                         $tmp.= substr($encrypt_key,$ctr,1) .
  35.                         (substr($txt,$i,1) ^ substr($encrypt_key,$ctr,1));
  36.                         $ctr++;
  37.                 }
  38.                 return $this->SetToHexString($this->keyED($tmp,$key));
  39.         }
  40.  
  41.         public function decrypt($txt,$key="") {
  42.                 if(empty($key)){
  43.                         $key=$this->key;
  44.                 }
  45.  
  46.                 $txt = $this->UnsetFromHexString($txt);
  47.                
  48.                 $txt = $this->keyED($txt,$key);
  49.                 $tmp = "";
  50.                 for ($i=0;$i<strlen($txt);$i++) {
  51.                         $md5 = substr($txt,$i,1);
  52.                         $i++;
  53.                         $tmp.= (substr($txt,$i,1) ^ $md5);
  54.                 }
  55.                 return $tmp;
  56.         }
  57.  
  58.         public function setKey($key) {
  59.                 if(empty($key)){
  60.                         return null;
  61.                 }
  62.                 $this->key=$key;
  63.         }
  64.  
  65.         public function getKey() {
  66.                 return $this->key;
  67.         }
  68.        
  69.        
  70.        
  71.         //////////////////////////此处一下转16进制
  72.         public function SingleDecToHex($dec)
  73.         {
  74.                 $tmp="";
  75.                 $dec=$dec%16;
  76.                 if($dec<10)
  77.                         return $tmp.$dec;
  78.                 $arr=array("a","b","c","d","e","f");
  79.                 return $tmp.$arr[$dec-10];
  80.         }
  81.         public function SingleHexToDec($hex)
  82.         {
  83.                 $v=ord($hex);
  84.                 if(47<$v&&$v<58)
  85.                         return $v-48;
  86.                 if(96<$v&&$v<103)
  87.                         return $v-87;
  88.         }
  89.         public function SetToHexString($str)
  90.         {
  91.                 if(!$str)return false;
  92.                 $tmp="";
  93.                 for($i=0;$i<strlen($str);$i++)
  94.                 {
  95.                         $ord=ord($str[$i]);
  96.                         $tmp.=$this->SingleDecToHex(($ord-$ord%16)/16);
  97.                         $tmp.=$this->SingleDecToHex($ord%16);
  98.                 }
  99.                 return $tmp;
  100.         }
  101.         public function UnsetFromHexString($str)
  102.         {
  103.                 if(!$str)return false;
  104.                 $tmp="";
  105.                 for($i=0;$i<strlen($str);$i+=2)
  106.                 {
  107.                         $tmp.=chr($this->SingleHexToDec(substr($str,$i,1))*16+$this->SingleHexToDec(substr($str,$i+1,1)));
  108.                 }
  109.                 return $tmp;
  110.         }
  111.        
  112. /*
  113. echo SetToHexString("hello,大家好123");
  114. echo "<hr>";
  115. echo UnsetFromHexString(SetToHexString("hello,大家好123"));
  116. */
  117.        
  118.  
  119. }
  120.  
  121.  
  122.  
  123. /*
  124. $crypt= new crypt();
  125. $enc_text = $crypt->encrypt('123456','wwwthinksaascn2012');
  126. $dec_text = $crypt->decrypt($enc_text,'wwwthinksaascn2012');
  127. */