wecenter 点管理进入后台的时候 弹出页面提示crypt.php有错误代码,弹出地址是:域名/?/admin/
提示:
PHP Warning: mdecrypt_generic(): An empty string was passed in D:\freehost\yiguxi\web\fangshanzhai\system\core\crypt.php on line 58 PHP Warning: gzuncompress(): data error in D:\freehost\yiguxi\web\fangshanzhai\system\core\crypt.php on line 63
新安装的wecenter,其他页面正常,请问怎么解决,哪位指点一下,谢谢!
已解决,方法:直接输入地址:你的域名/?/admin/login/
crypt.php 代码:
<?php
/*
+--------------------------------------------------------------------------
| WeCenter [#RELEASE_VERSION#]
| ========================================
| by WeCenter Software
| © 2011 - 2014 WeCenter. All Rights Reserved
| http://www.wecenter.com
| ========================================
| Support: WeCenter@qq.com
|
+---------------------------------------------------------------------------
*/
class core_crypt
{
public function __construct()
{
if (!function_exists('mcrypt_module_open'))
{
exit('Error: Mcrypt Module not support');
}
}
public function encode($data, $key = null)
{
$mcrypt = mcrypt_module_open($this->get_algorithms(), '', MCRYPT_MODE_ECB, '');
mcrypt_generic_init($mcrypt, $this->get_key($mcrypt, $key), mcrypt_create_iv(mcrypt_enc_get_iv_size($mcrypt), MCRYPT_RAND));
$result = mcrypt_generic($mcrypt, gzcompress($data));
mcrypt_generic_deinit($mcrypt);
mcrypt_module_close($mcrypt);
return $this->get_algorithms() . '|' . $this->str_to_hex($result);
}
public function decode($data, $key = null)
{
if ($algorithm = strstr($data, '|', true))
{
$data = str_replace($algorithm . '|', '', $data);
$data = $this->hex_to_str($data);
}
else
{
$algorithm = $this->get_algorithms();
$data = base64_decode($data);
}
$mcrypt = mcrypt_module_open($algorithm, '', MCRYPT_MODE_ECB, '');
mcrypt_generic_init($mcrypt, $this->get_key($mcrypt, $key), mcrypt_create_iv(mcrypt_enc_get_iv_size($mcrypt), MCRYPT_RAND));
$result = trim(mdecrypt_generic($mcrypt, $data));
mcrypt_generic_deinit($mcrypt);
mcrypt_module_close($mcrypt);
return gzuncompress($result);
}
private function get_key($mcrypt, $key = null)
{
if (!$key)
{
$key = G_COOKIE_HASH_KEY;
}
return substr($key, 0, mcrypt_enc_get_key_size($mcrypt));
}
private function get_algorithms()
{
$algorithms = mcrypt_list_algorithms();
foreach ($algorithms AS $algorithm)
{
if (strstr($algorithm, '-256'))
{
return $algorithm;
}
}
foreach ($algorithms AS $algorithm)
{
if (strstr($algorithm, '-128'))
{
return $algorithm;
}
}
return end($algorithms);
}
private function str_to_hex($string)
{
for ($i = 0; $i < strlen($string); $i++)
{
$ord = ord($string[$i]);
$hexCode = dechex($ord);
$hex .= substr('0' . $hexCode, -2);
}
return strtoupper($hex);
}
private function hex_to_str($hex)
{
for ($i = 0; $i < strlen($hex)-1; $i += 2)
{
$string .= chr(hexdec($hex[$i] . $hex[$i + 1]));
}
return $string;
}
}
阅读全文
收起全文