Welcome Guest, Not a member yet? Register   Sign In
Encrypt Problem
#1

[eluser]JasmineFlower[/eluser]
Hi,

I use codeigniter 2.0.2. I have a registration page, confirmation mail send to email after registration. In that confirmation mail having activation link .The activation link like as below


Please click the link to confirm your Registration

http://domain.com/foldername/controller/...gpfvgW+xQA==


In this encrypted code have slash /. when it passed through url, the segment will be separated by slash.
so i cant decrypt the code.

I use encrypt library.

How to solve this issue?

pls anyone know this help me.
#2

[eluser]toopay[/eluser]
Use _remap. Suppose the first segment is a key, and the second is the message, you can do...
Code:
class Confirmation extends CI_Controller {
    
    public function _remap($method, $params = array())
    {
        if(count($params) == 1)
        {
            $res = $this->encrypt->decode($params[0], $method);
            // Do something...
            //...
            // Give the redirect as a result
            redirect(($success == TRUE) ? 'success_controller' : 'failed_controller');
        }
        // If the parameter is empty or not match, throw 404 error
        show_404();
    }
}
#3

[eluser]JasmineFlower[/eluser]
Hi toopay,

I use encrypt library and i give the encryption key in config file.

Code:
$config['encryption_key'] = 'jdbeofyhfo';

In my model

Code:
$msg = $userid.$email;        
$encyptres=$this->encrypt->encode($msg);


This $encryptres sometimes returns with slash /.
BWCPaBqxRiGWFzJ8/Uib339JB0kpW1Gccaec43mvLwMI3XtuqmRmR1HmaSyYhkMnCmqQljzKnxWdgpfvgW+xQA==

after click confirmation link it returns only

BWCPaBqxRiGWFzJ8
#4

[eluser]JasmineFlower[/eluser]
Hi toopay,


How to avoid the /,&,% in encryption.

I need encryption & decryption(two way method).
#5

[eluser]WanWizard[/eluser]
If you use the encoded string in a situation where that is an issue, urlencode() it.
#6

[eluser]toopay[/eluser]
[quote author="JasmineFlower" date="1309865802"]Hi toopay,


How to avoid the /,&,% in encryption.

I need encryption & decryption(two way method).[/quote]

You doen'st need to use remap function then, just use urlencode() - urldecode() to wrap or transport your encrypted message.

Code:
// In your model :
$msg = $userid.$email;        
$encyptres = urlencode($this->encrypt->encode($msg));

// In your Confirmation controller method that accept the encrypted message :
function some_method($msg = '')
{
  if($msg == '') show_404();
  $res = $this->encrypt->decode(urldecode($msg));
  // Do something...
  //...
  // Give the redirect as a result
  redirect(($success == TRUE) ? 'success_controller' : 'failed_controller');
}




Theme © iAndrew 2016 - Forum software by © MyBB