Page 1 of 1

User login with cookies via PHP w/o SQL

Posted: Thu Jul 01, 2004 3:56 am
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... ;)

Posted: Thu Jul 01, 2004 4:18 am
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 :)

yeah

Posted: Thu Jul 01, 2004 4:31 am
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

Posted: Thu Jul 01, 2004 4:56 am
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.

heh

Posted: Thu Jul 01, 2004 6:02 am
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

Posted: Thu Jul 01, 2004 6:24 am
by Grim...
Normally "localhost", sometimes the servers IP address (if it's remote, obv.).

great

Posted: Thu Jul 01, 2004 6:48 am
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... :)