Password script needed

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I know there are session and application variables in ASP. Is there something like this in PHP?

I need to make a password script with PHP. I would like it to prompt the visitor with the usual username/password and store it in a session variable, so as long as they don't close their browser, they don't have to re-type their logon info. But this NEEDS to be secure.

Any help welcome, but I'm looking more for literature than prefab scripts. Thanks!

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 429 posts

Joined: Jul 2000

This one took me some time to find. Smiling

http://hotwired.lycos.com/webmonkey/00/05/index2a.html?tw=programming

Although I don't like Webmonkey a whole lot, I think this'll help.

Mike Fisher - TWF Conquerer
"Don't trust a spiritual leader that cannot dance."

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

thanks

I also found this:
http://php.net/manual/ref.session.php

I plan to prompt for username/password, then check it against a database. If they are authorized, start a session variable. Then everywhere they go on the site, they should have full access (or maybe muiltple level users, hmmm).

When they close their browser the session variables will be lost (this is good). Or when click a logout button, I execute a 'session_destroy' and teminate the session.

The next time they visit they will have to 'log on' again.

Mark Hensler
If there is no answer on Google, then there is no question.

They have: 36 posts

Joined: Jun 2000

wow and i thought webmonkey was cool.

Laughing out loud

They have: 429 posts

Joined: Jul 2000

Oh, it's 'alright,' and all, but some times they really limit themselves in what they do. Some of their tutorials could've been simplified so much.

Ahh well, don't listen to me. I'm bad for your teeth.

Mike Fisher - TWF Conquerer
"Don't trust a spiritual leader that cannot dance."

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

It correctly checks user input with database for usename/password. Then it creats a session and registers a variable. Then I say:
$GLOBALS["var"] = "something";
But I can't seem to get this on other pages.

Also... when the use clicks logout, I execute a session_destroy(), but the session doesn't seem to die.

Anyone have any help?

Thanks

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.