• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[ask] how to encrypt the url?

#1
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" .
Reply

#2
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.
Reply

#3
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.
Reply

#4
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 )
Reply

#5
Read this (all of you): https://paragonie.com/blog/2015/09/compr...ion-in-php
Reply

#6
Thanks @Narf
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#7
(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?
Reply

#8
(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

This comes close to my idea, doesn't it?

Yours is the closest one mentioned, yes. But every detail is important.
Reply

#9
thankyou for the explanation guys, i will try it
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.