You are here: Re: Accesing a record in MySQL and PHP « PHP Programming Language « IT news, forums, messages
Re: Accesing a record in MySQL and PHP

Posted by Stuart Millington on 10/25/50 11:34

On 12 Dec 2005 16:02:23 -0800, "zek2005" <esapoznik@gmail.com> wrote:

>As example, I´d like that
>http://www.mysite.com/page.php?id=ewrefj34239dsa
>
>equals
>http://www.mysite.com/page.php?id=16

Other than an MD5 hash, a simple solution - obfuscation really - would
be to:

Put the ID characters within a string made up of random characters:
get the length of the ID string and for each character, prepend it
with X random characters, then append the string with X random
characters, e.g where X=4.

16 becomes: ghty1juh56i1k4
161 becomes: agdh1ag5h6ah4d1ah4f

To decode it, strip off the last X characters, divide the remaining
length by (X+1) to figure out how many characters are in the original
ID, then get each X+1th character to reconstruct the original ID.

It's not real security, but whether it's appropriate depends on why
you want to hide the ID and the value of the ID to someone who has
enough examples to decode it (or look for MD5 hash matches).

--
------------------------------------------------------------------
- Stuart Millington ALL HTML e-mail rejected -
- mailto:phupp@dsv1.co.uk http://w3.z-add.co.uk/ -

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация