2013-04-15 134 views
0

在CI中的一个Web应用程序中,它们用于将COOKIE数据保存为加密形式,并通过解密进行检索。由于某些安全原因(不知道为什么),“GoDaddy”阻止了“base64_encode”,它工作正常。这是我得到的错误PHP-Codeigniter字符串加密和解密

A PHP Error was encountered 
Severity: Warning 
Message: base64_decode() has been disabled for security reasons 
Filename: models/extras.php 
Line Number: 196 

我的加密和解密代码如下。有没有其他的方法可以用“base64_encode”来做同样的事情?

function encodeString($str){ 
    for($i=0; $i<5;$i++) 
    { 
    $str=strrev(base64_encode($str)); //apply base64 first and then reverse the string 
    } 
    return $str; 
} 

function decodeString($str){ 
    for($i=0; $i<5;$i++) 
    { 
    $str=base64_decode(strrev($str)); //apply base64 first and then reverse the string} 
    } 
    return $str; 
} 

在此先感谢

+1

Wat?什么原因可能会导致禁用这样一个良性但至关重要的功能? – deceze

+1

@ramesh您必须要求您的托管服务提供商启用这些功能或更改您的托管服务提供商。它依赖于你。 –

+0

是的..我要求托管服务提供商的“GoDaddy”......他们说他们不能接受“base64_encode”,我已经购买了服务器2年,还剩1.5年..他们不会退款 – ramesh

回答

1

为了消除你需要做以下事情之一此错误消息:

  • 在php.ini中*文件中删除从disable_functions选项的BASE64_DECODE串
  • 要求您的托管服务提供商删除上面的字符串,如果您没有访问php.ini文件
  • 更改托管服务提供商whi ch允许运行base64_decode函数。
-1
$data =array(   

'password' => md5($this->input->post('password')), 

);