• Notice regarding image hosts and attachments. See here.

user authentification

Associate
Joined
13 Jul 2005
Posts
740
Location
Brisbane
ok so i am logged in and a new session for 'uid' has been set
PHP Code:
PHP:
$_SESSION['uid']=$loggedinuser;

, now i wish to create a user authentification system to go at the top of each page to check if a user is logged in, and if not redirect them to login.php.

so far i have got:


PHP Code:
PHP:
<?php // useracesss.php 
session_start(); 

$uid = isset($_POST['uid']) ? $_POST['uid'] : $_SESSION['uid']; 
$pwd = isset($_POST['pwd']) ? $_POST['pwd'] : $_SESSION['pwd']; 

if(!isset($uid)) { 
header('Location: login.php'); 
} 
?>
it is working, but i am not sure if the code is correct?

Also i want to create a user access file so if a user has previously logged into my site in the same browser session, and go to google for e.g. when they return to my site they will automatically be redirected to main.php (user area).

any ideas on how i can accomplish this?

cheers tucks
 
Back
Top Bottom