[ask] how to encrypt the url? |
when we pass a paramter in Url, the paramter is visible. sometime it is privacy.
so how to encrypt the parameter in codeigniter. like http://localhost/ani_3TIA/mahasiswa/edit/5 , i want to encrypt the "5" .
Add another VARCHAR field to your table, named "secret_id".
If you insert a record, store a random string into that field. You can use CI's string helper. In your url's, don't use the record id, but instead the secret_id. If you want to be really safe, check if the random string already exists in your table before the record is inserted. If so, generate a new random string. Hope this will help.
Encode:
1. XOR with a "SECRET" number (stored in cogfig). 2. Encode with base64/base26 (for example). Decode: 1. Decode with base64/base26 (for example). 2. XOR with a "SECRET" number (stored in cogfig). In this case you no need to generate (with checking for duplicated values) and store addition data and values will be unique*. -- * Depends of encode/decode algorithm.
See the PHP methods urlencode and urldecode.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Read this (all of you): https://paragonie.com/blog/2015/09/compr...ion-in-php
(11-03-2017, 03:48 AM)Narf Wrote: Read this (all of you): https://paragonie.com/blog/2015/09/compr...ion-in-php This comes close to my idea, doesn't it? (11-03-2017, 06:04 AM)Wouter60 Wrote:(11-03-2017, 03:48 AM)Narf Wrote: Read this (all of you): https://paragonie.com/blog/2015/09/compr...ion-in-php Yours is the closest one mentioned, yes. But every detail is important.
|
Welcome Guest, Not a member yet? Register Sign In |