note 53770 added to function.md5
| From: | ThomasHolz at osu1 dot php dot net | Date: | Sun, 12 Jun 2005 19:53:39 +0000 |
| Subject: | note 53770 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90318@lists.php.net to get a copy of this message | ||
You can easily use md5() to create safe (signed) links, which cannot created by anybody else. This
can be useful to transfer the user from one page to another without allowing him to manipulate any
parameters (product price for example).
Example URL: (don't click it, it's just an example ;-)
http://www.easy2sync.com/?p1=myvalue&p2=ABCDEF0123456789
To make this secure, generate p2 as md5($p1."mysecretvalue");
This way, you can use md5 as a primitive signature. As long as you keep your secret string really
secret, nobody else can generate links that you target page would accept (since it would compare p2
with the md5 result of p1 and secret string).
Thomas
--------------------------------------------
http://www.easy2sync.com/en/produkte/e2s4o.php
----
Manual Page -- http://www.php.net/manual/en/function.md5.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53770
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53770&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53770&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53770&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53770&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53770&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53770&report=yes
Search -- http://master.php.net/manage/user-notes.php