![]() |
Not Passing encoded variable % to Controller - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Not Passing encoded variable % to Controller (/showthread.php?tid=77729) |
Not Passing encoded variable % to Controller - chetankchandak - 10-11-2020 I have to encode urls linking to my invoice pages. on All invoice page: Code: <?php $pdfurl = urlencode(base64_encode($this->encrypt->encode($list->order_id))); www.website.com/pdf/13 to www.website.com/pdf/Z1FSMmNkcG9NWHNrc2V3MzZvY2grY0pzQUVtSEZRYTFrMmU0RTMreWFNa3MzS29tdXhJRzJBUnQwNGJhR1lwcEZLdjUvTTlLbnJ0YmNSQ2Q2RTlyekE9PQ%3D%3D My controller code is: in controller when $pdfurl is called it carries Z1FSMmNkcG9NWHNrc2V3MzZvY2grY0pzQUVtSEZRYTFrMmU0RTMreWFNa3MzS29tdXhJRzJBUnQwNGJhR1lwcEZLdjUvTTlLbnJ0YmNSQ2Q2RTlyekE9PQ== It drops %3D%3D and appends == at the end. This doesnot decodes to the original variable value which is 13. instead it decodes to : gQR2cdpoMXsksew36och+cJsAEmHFQa1k2e4E3+yaMks3KomuxIG2ARt04baGYppFKv5/M9KnrtbcRCd6E9rzA== Pls help, i am doing this for first time. Code: function pdf($pdfurl){ My Config file has: Code: $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-@\='; Route file: Code: $route['pdf/(:any)'] = 'Afterlogin_admin/pdf/$1'; RE: Not Passing encoded variable % to Controller - includebeer - 10-16-2020 I don't think you need to call rawurldecode in your controller. I'm pretty sure it is already decoded for you. Try this: PHP Code: $order_id = base64_decode($pdfurl); |