2. [代码][PHP]代码
class CCEncode{
public static $instance = NULL;
public static function getInstance(){
if(is_null(self::$instance)){
self::$instance = new self;
}
return self::$instance;
}
protected function getByte($data){
$length = strlen($data);
for($i = 0; $i < $length; $i ++){
$tmpList[] = ord($data{$i});
}
return $tmpList;
}
protected function getChar($data, $string = ''){
$length = count($data);
foreach($data as $value){
$string .= chr($value);
}
return $string;
}
public function encrypt($data, $key){
$dataArr = $this->getByte($data);
$keyArr = $this->getByte($key);
$lengthA = count($dataArr);
$lengthB = count($keyArr);
for($i = 0; $i < $lengthA; $i ++){
$tmpList[] = (0xFF & $dataArr[$i]) + (0xFF & $keyArr[$i % $lengthB]);
}
return implode('@', $tmpList);
}
public function decrypt($data, $key){
$dataArr = explode('@', $data);
$keyArr = $this->getByte($key);
$lengthA = count($dataArr);
$lengthB = count($keyArr);
for($i = 0; $i < $lengthA; $i ++){
$tmpList[] = $dataArr[$i] - (0xFF & $keyArr[$i % $lengthB]);
}
return $this->getChar($tmpList);
}
}
请注意以下说明:1、本程序允许任何人免费使用。2、本程序采用PHP+MYSQL架构编写。并且经过ZEND加密,所以运行环境需要有ZEND引擎支持。3、需要售后服务的,请与本作者联系,联系方式见下方。4、本程序还可以与您的网站想整合,可以实现用户在线服务功能,可以让客户管理自己的信息,可以查询自己的订单状况。以及返点信息等相关客户利益的信息。这个功能可提高客户的向心度。安装方法:1、解压本系统,放在










