📄 soapoas.class.php
字号:
<?php
/**
* @package cwps.oas
* $Id: SoapOAS.class.php,v 1.5 2006/09/10 05:27:18 Administrator Exp $
*/
define("SOAP_OK", 0);
define("SOAP_UNKNOWN_ERROR", 1);
define("SOAP_LOGIC_ERROR", 2);
define("SOAP_OAS_IP_Invalid",4000);
define("SOAP_TransactionAccessKey_Error", 4001);
define("SOAP_Action_Null", 4002);
define("SOAP_Action_NotRegistered", 4003);
define("SOAP_Action_NotExists", 4004);
define("SOAP_Response_TransactionID_Error", 4005);
define("SOAP_DB_ERROR", 9000);
function oas_encrypt($txt, $key) {
srand((double)microtime() * 1000000);
$encrypt_key = md5(rand(0, 32000));
$ctr = 0;
$tmp = '';
for($i = 0;$i < strlen($txt); $i++) {
$ctr = $ctr == strlen($encrypt_key) ? 0 : $ctr;
$tmp .= $encrypt_key[$ctr].($txt[$i] ^ $encrypt_key[$ctr++]);
}
return base64_encode(oas_key($tmp, $key));
}
function oas_decrypt($txt, $key) {
$txt = oas_key(base64_decode($txt), $key);
$tmp = '';
for ($i = 0;$i < strlen($txt); $i++) {
$md5 = $txt[$i];
$tmp .= $txt[++$i] ^ $md5;
}
return $tmp;
}
function oas_key($txt, $encrypt_key) {
$encrypt_key = md5($encrypt_key);
$ctr = 0;
$tmp = '';
for($i = 0; $i < strlen($txt); $i++) {
$ctr = $ctr == strlen($encrypt_key) ? 0 : $ctr;
$tmp .= $txt[$i] ^ $encrypt_key[$ctr++];
}
return $tmp;
}
/**
* OAS绔
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -