Ok heres my issue.
I have a table setup users. It has usergroupid, username, etc. I wanna get some code something small that where if usergroupid < 5 then it will redirect you to say index.php but if its > 5 it will let the page load. Any ideas ?
Ok heres my issue.
I have a table setup users. It has usergroupid, username, etc. I wanna get some code something small that where if usergroupid < 5 then it will redirect you to say index.php but if its > 5 it will let the page load. Any ideas ?
If you are using a session-based login system, as part of the login process store the group ID in a $SESSION variable. Then simply check the value of $SESSION['groupid'] and act accordingly.
Thats the issue. Ive never messed with using $_session so wouldnt even know where to start. ive tried finding stuff to read on it but i cant find anything that would redirect the person if x doesnt = y
if($x != $y)
{
header("Location: http://www.example.com/another_page.php");
exit;
}
// rest of script if $x does equal $y . . .
You'll wanna look into the PHP manual section on Sessions:
http://us.php.net/session
Headers:
http://php.net/header
And ... possibly if/else control structures.