Hi there
I need to add a session to my page that Gets A value from the database and according to that value it redirects the user to a particular part of the site
any ideas anyone?
any help will be much appreciated
Thanks
Al
Add session
Moderator: General Moderators
I don't see why you need a session, do your query then do the redirect...
printf
Code: Select all
// db connect, select here
$query = mysql_query ( "SELECT permission FROM users WHERE uid = " . $user['id'] );
$test = mysql_fetch_assoc ( $query );
switch ( $test['permission'] )
{
case 0 :
$page = 'login.php';
break;
case 1 :
$page = 'admin.php';
break;
case 2 :
$page = 'members.php';
break;
}
header ( 'Location: http://www.site.com/' . $page );
exit ();printf
session_start() starts a session, then you can access variables like this:
-wyrmmage
Code: Select all
<?
session_start();
$_SESSION[$variableName] = "whatever";
?>