Posts: 2
Threads: 1
Joined: Oct 2017
Reputation:
0
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" .
Posts: 852
Threads: 37
Joined: Feb 2015
Reputation:
77
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.
Posts: 18
Threads: 2
Joined: Jul 2016
Reputation:
0
11-03-2017, 01:22 AM
(This post was last modified: 11-03-2017, 01:26 AM by Vitaly83.)
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.
Posts: 4,363
Threads: 101
Joined: Oct 2014
Reputation:
146
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 )
Posts: 2
Threads: 1
Joined: Oct 2017
Reputation:
0
thankyou for the explanation guys, i will try it