Not Passing encoded variable % to Controller |
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';
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);
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Welcome Guest, Not a member yet? Register Sign In |