• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
encrypt class problem

#1
[eluser]PHPraja[/eluser]
hi guys...

i have used encrypt library for encryption of userids etc in my project. It works well in my local system but i m facing problem in client's centos system.
The problem is that in the encrypted string sometimes '/' is also present which CI treats as 2 different uri segments.

How to restrict '/' in the encrypted string.
The code i used as below
Code:
<a >encrypt->encode($docinfo['id']);?&gt;/&lt;?=$this->encrypt->encode('summary')?&gt;">

$this->encrypt->encode($docinfo['id']) - This is resulting to a encrypted string which includes '/' in it. This causes problem as CI treats as 2 different URI segments. How to solve this prob any one has idea ?

thanks
raja

#2
[eluser]Pascal Kriete[/eluser]
Base64 encoding it will solve the problem, although it isn't the most graceful solution.

The forum has become a little biased towards links in code tags Tongue .

#3
[eluser]Sumon[/eluser]
$this->encrypt->encode() use base64_encode() & base64_decode() function[Have a look /libraries/Encrypt.php].
So is it really solve this problem?

#4
[eluser]Pascal Kriete[/eluser]
Ignore what I said, I was being stupid. / is a valid character in the base64 alphabet.

New solution, replace / with another character.
Code:
$encoded = $this->encrypt->encode....
$encoded = strtr($encoded, '+/=', '-_,');

// And back again
$decoded = strtr($encoded, '-_,', '+/=');
$decoded = $this->encrypt->decode...

#5
[eluser]Yash[/eluser]
but it may conflict...I can't say

#6
[eluser]Pascal Kriete[/eluser]
What may conflict?

#7
[eluser]PHPraja[/eluser]
ok friends thanks for the answers.

At last i could solve it by commenting the mycrypt functions in /libraries/Encrypt.php (encode and decode functions)
Because of the mycrypt functions it is encoding the encoded string, which may result in '/' in that final encrypted string.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.