I have a working script to allow people into a particular page on my site, but what im wanting is to restrict what people are able to see from the links after a successfull login. Here is the login script But what i'm wanting is say user 'Test1' to be able to see all the links once they have successfully logged on, but say user 'Test2' to be only able to see link 2, and say if there was a 3rd user, to be able to see links 1 & 3, but not 2. So is this possible? And if so, anyone able to help me with it as i'm totally lost. Thanks in advance...
Store what user they are once they login...? $_SESSION['user'] = $_POST['username']; Then, do something like this to display links.. switch($_SESSION['user']) { case "Test1"; echo 'link 1 link 2 link 3'; break; case "Test2"; echo 'link 2'; break; case "Test3"; echo 'link 1 link 3'; break; } PHP: Of course, you could also just do a bunch of IF statements (switches can be better for things like this). $user = $_SESSION['user']; #too lazy to keep typing out $_SESSION['user'] if($user=='Test1') { echo 'link 1 link 2 link 3'; } elseif($user=='Test2') { echo 'link 2'; } elseif($user=='Test3') { echo 'link 1 link 3'; } PHP:
Are you really going to be defining what each and every one of your users are going to be seeing on an individual basis or are you really taking about having "roles"? If it is groups of people then simply set a session item for which role that particular user belongs to and test for that role rather than that user when deciding if an item should be shown or not (aka roles based access control)