0

In one web application in CI, they used to save COOKIE data as an encrypted form and retrieve by decrypting it. Its was working fine since "GoDaddy" blocked "base64_encode" due to some security reasons ( Don't know why ). This is the error which I got

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

My encrypt and decrypt code as follows. Is there any alternate method for doing the same with out "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;
}

Thanks in advance

3
  • 1
    Wat? What harebrained reason could there be for disabling such a benign yet essential function?! Commented Apr 15, 2013 at 6:07
  • 1
    @ramesh You have to ask you Hosting Provider to enable those function or Change your hosting provider. It is dependent on you. Commented Apr 15, 2013 at 6:11
  • Yea .. I requested in hosting provider its "GoDaddy" ... They said they can't accept "base64_encode", I already purchased the server for 2 years and its 1.5year left.. they wont refund Commented Apr 15, 2013 at 7:03

2 Answers 2

1

In order to eliminate this error message you need to do ONE of the following things:

  • Remove the base64_decode string from the disable_functions at php.ini* file
  • Ask your hosting provider to remove the string above if you don't have an access to the php.ini* file
  • Change hosting provider which allows the running of the base64_decode function.
Sign up to request clarification or add additional context in comments.

Comments

0
$data =array(           

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

);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.