• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to pass encrypt GET variable

#1
[eluser]lamperz[/eluser]
Hi, guys
I'm development some kind of register confirm.

URL likes
http://www.example.com/apply/confirm/A2AAb1+0W1Vbw
was sended to user by email.

character likes A2AAb1+0W1Vbw was username encrypted by CI's encrypt library.

But I got "/" or "+" in ciphertext occasionally, AND those
characters is illegal in URL.

Any idea?
I'll waitting online

#2
[eluser]lamperz[/eluser]
I found ~ _ - was in $config['permitted_uri_chars']
and illegal characters is + = /
so we can str_replace + = / with ~ _ -

#3
[eluser]sobencha[/eluser]
Couldn't you just use the PHP urlencode() function? If you used this when creating the email containing the URL, it should escape any of the characters causing you problems. Then just use the urldecode() function when you process and unencrypt the string.

#4
[eluser]lamperz[/eluser]
urlencode will bring in % which is also illegal charactor in CI config

#5
[eluser]oll[/eluser]
You should use sthing like :

$key=md5(uniqid($username));
and send :
http://mysite/controller/model/$key as url

You don't have to use the encrypt helper (at least not in the goal of being able to decrypt the key for knowing the user).
Just create a waitforconfirm table with at least 2 fields : a username field and a "password" field.


You will know your user using a query that looks like : "select * from waitforconfirm where password=$key"

This link might help :
http://www.phpeasystep.com/workshopview.php?id=24

#6
[eluser]Derek Allard[/eluser]
What about
Code:
$this->load->helper('string');
$random_passkey = random_string('alnum', 13);


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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