...

View Full Version : PHP Session ID Login



wappo
10-01-2003, 05:34 PM
Hi can anyone help me creating this script:
1. I want to create a script what you can register to a site and it stores your details in maybe a cookie format. When you come to login it grabs the cookie and also sets a session ID. Please can anyone help me?

Nightfire
10-01-2003, 08:05 PM
I want to create a script what you can register to a site and it stores your details in maybe a cookie format


session_start();
// form processed already, this is the validation page
// form field called username

setCookie("username",$_POST['username'],time()+36000);
// Cookie now set with username included

$_SESSION['username'] = $_POST['username'];

// Session now set with username

Now login page


if(isset($_COOKIE['username'])){
// do query on cookie info to check the user does actually exist etc
}elseif(isset($_SESSION['username'])){
// Send straight to members area, as user is already logged in
}else{
// Send to login form
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum