User login with cookies via PHP w/o SQL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
fresh
Forum Contributor
Posts: 259
Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika

User login with cookies via PHP w/o SQL

Post by fresh »

Hello,

I need a quick alternative to the user login and logout routine for my site. By quick I mean, simple. I am looking for an alternative way to doing this, with cookies, without SQL. Has anyone got a working example, or a good place to learn? Thanks in advance... ;)
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

When they login, give them a cookie.

When they logout, take away their cookie.

If they've got a cookie, they're logged in.

That's pretty simple :)
User avatar
fresh
Forum Contributor
Posts: 259
Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika

yeah

Post by fresh »

sounds simple... however, I have no idea what to do with PHP involved... I want to encrypt the pass and store it... but is that even safe, without SQL... I dont want to compromise my users... im just looking for an example of this being used succesfully, without SQL. Thanks
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

You'd need to create a file that stores the information, take a look at PHP's [php_man]Filesystem functions[/php_man] for more information.
User avatar
fresh
Forum Contributor
Posts: 259
Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika

heh

Post by fresh »

can someone explain to me what I put here:

Code: Select all

$db_engine = 'thisisfine'; 
$db_user = 'thisisfine';
$db_pass = 'thisisfine';
$db_host = '????';  <-----------what do I put here
$db_name = 'thisisfine';
Im wondering what the normal format is, I took what it was saying the local host was xxxxxx@localhost.... but it gave me an error... db: could not connect.... thanks in advance
Grim...
DevNet Resident
Posts: 1445
Joined: Tue May 18, 2004 5:32 am
Location: London, UK

Post by Grim... »

Normally "localhost", sometimes the servers IP address (if it's remote, obv.).
User avatar
fresh
Forum Contributor
Posts: 259
Joined: Mon Jun 14, 2004 10:39 am
Location: Amerika

great

Post by fresh »

I followed your link and found an md5 encrypter script, I got it working for my scenario, and am thinking about just .htpasswding the dir... but I didn't try 'localhost'... so I will, thank you for the help, I appreciate it... :)
Post Reply