coviex...
I tried your solution to question #1...
What I did was place the code you provided me with onto let's say (members.php and admin.php):
<?php
if (!isset($_SESSION['logged_
{
header("Location:index.php
}
?>
Now, without logging in, I try to access those pages by typing in the full url...The result takes me to index.php. When I try to login, the result takes me to index.php. I can't get anywhere but the index...So then I was thinking that I should change the header on each page the code was pasted on, to that page's location...I tried that, and the result was the page loading very slow until it eventually timed out.
Maybe there is something I'm doing wrong? Or maybe I didn't post the code on the right pages? Can you clear some things up as to where I'm supposed to put the code, and am I supposed to change anything according to what page it is?
Thanks
Main Topics
Browse All Topics





by: coviexPosted on 2007-06-29 at 09:42:08ID: 19391496
1) You already have a session "$_SESSION['logged_in'] ".
in'] )) ");
So all you need now is to create a function or single file which will check if user is logged in right at the start of each script.
<?php
if (!isset($_SESSION['logged_
{
header("Location:index.php
}
?>
2) Create new field in members table in DB and grant certain access rights upon registration process or whenever you want later depending on certain user`s action.
Then in index.php instead of
<?php
if($row['Active'] == 1)
{
session_start();
$_SESSION['user_id'] = $row['ID'];
$_SESSION['logged_in'] = TRUE;
header("Location: members.php");
}
?>
white something like :
<?php
if($row['Active'] == 1)
{
session_start();
$_SESSION['user_id'] = $row['ID'];
$_SESSION['logged_in'] = TRUE;
switch ($row['level'])
{
case 1 :
{
header("Location: admin.php");
break;
}
case 2 :
{
header("Location: members.php");
break;
}
}
}
?>