Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how pass base64encode characters in codeigniter url?

I have URL like this http://domain/home/activate/MzU= .the parameter

 "MzU=" = base64encode($data)

I cant open this URL with this parameter. Error like this!"The URI you submitted has disallowed characters." How can i pass base64encode characters in codeigniter url?

like image 299
crynaldo madrid Avatar asked Sep 22 '26 13:09

crynaldo madrid


2 Answers

You can create a helper with the following functions:

function url_query_encode($array = array())
{
    return str_replace('/', '_', rtrim(base64_encode(gzcompress(serialize($array))), '='));
}


function url_query_decode($str = '')
{
    return (is_string($str) && strlen($str)) ? @unserialize(gzuncompress(base64_decode(str_replace('_', '/', $str)))) : FALSE;
}
like image 102
fccotech Avatar answered Sep 24 '26 03:09

fccotech


Please add the character "=" to $config['permitted_uri_chars'] in your config.php file which is available in your application/config directory

like image 30
Hasib Tarafder Avatar answered Sep 24 '26 04:09

Hasib Tarafder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!