php - Ignore Slash while using encryption in codeigniter -


i have problem encrypt/decrypt email, send link on mail this

http://www.domain.com/mycontroller/myfunction/mcvbsce........etc 

the last segment encrypted email id, decrypt email , update stus in db when user click on link.all done right.

problem: when url this

http://www.domain.com/mycontroller/myfunction/mcvb/sce 

it shows 404 error, because slash included in generated encryption key.how can ignore slash while generate encryption, that's main problem, rest working fine.

you need use class, include file in applicatio/libraries folder, had same issue:

class my_encrypt extends ci_encrypt {     /**      * encodes string.      *       * @param string $string string encrypt.      * @param string $key[optional] key encrypt with.      * @param bool $url_safe[optional] specifies whether or not      *                returned string should url-safe.      * @return string      */     function encode($string, $key="", $url_safe=true)     {         $ret = parent::encode($string, $key);          if ($url_safe)         {             $ret = strtr(                     $ret,                     array(                         '+' => '.',                         '=' => '-',                         '/' => '~'                     )                 );         }          return $ret;     }      /**      * decodes given string.      *       * @access public      * @param string $string encrypted string decrypt.      * @param string $key[optional] key use decryption.      * @return string      */     function decode($string, $key="")     {         $string = strtr(                 $string,                 array(                     '.' => '+',                     '-' => '=',                     '~' => '/'                 )         );          return parent::decode($string, $key);     } } 

credit goes codeigniter forum, got this.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -