Hmm yes good question..

Security was (still is) a major for my organisation's site and I did
something a little unique and robust..

I love programming and I hate "stealing" (some call it borrowing) other
programmer's scripts/code from the web.. therefore I write it _all_ myself..

Trust me.. Sometimes this is a dumb attitude to take such as when I created
my first Perl discussion forum.. still running I think
( i think) and that consisted of this huge
perl system to maintain the files etc.. for members and the forum..

Anyway! off the sub now..

I used sessions and pass around the array of columns for that member/user ..
but the password is put through my own fairly unbreakable (yes.. I am
serious) password key system..

An idea to make your own safe keys to pass them around or use for
authenticating is simple maths and a crypt() or my preferred: md5()

I simply do some lovely maths like for each char of pword I loop through
them and append them onto the entire pword string plus the length, get the
md5 of that.. then md5 that md5 with the md5 of the previous result and then
do some maths, pick some specified characters (like every 3rd or whatever
you wish) .. strrev( reverse the string) md5 that again, all md5'ed again..

:) haha, you get the idea..

SO basically you'll end up with a nice 32 char string which is QUITE safe to
pass around and the chance anyone's gonna decrypt it IMHO is about zilch,
buckley's, zut, nil, null, zero..

And all you have to do, is when they login once, just run the password they
entered through this "algorithm" and check it against the stored algo'd

Ah yes that's the next thing.. the DB passwords will also have to be proc.
using your algorithm..

So it's kinda like a key security idea.. you are not meant to decrypt md5
hashes.. instead recreate it using what you are supplied and then compare
both hashes..

Simple :P

Ok hope that helps

:  Julien Bonastre [ CEO]
:  A.K.A. The_RadiX
:  ABN: 64 235 749 494
:  QUT Student :: 04475739
----- Original Message -----
From: "Pedro Pontes" <[EMAIL PROTECTED]>
Sent: Friday, May 03, 2002 10:19 PM
Subject: [PHP] Secure user authentication

> Hello,
> I'm using the regular user authentication method, that is, check the
> specified login/pass agains't the entries in the DB, if it is valid,
> the user object and register it with the section.
> How can we prevent any user from creating a simple PHP page that creates a
> simmilar user object, registers it with the session and then links to my
> pages? One way would be to check, in each page, for the password in the
> session user object and match it with the DB entry, but storing the
> in the session is not advisable, as other users in the host system may
> access to that information.
> Please advise.
> Thank you ver much for your time.
> --
> Pedro Alberto Pontes
> --
> PHP General Mailing List (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to