Thread: $_get
View Single Post
Old 02-05-2008, 02:25 PM   #5 (permalink)
RobertK
The Addict
Top Contributor Good Samaritan 
 
Join Date: Jan 2008
Location: USA
Posts: 217
Thanks: 16
RobertK is on a distinguished road
Default

Quote:
How do I prevent users from writing member.php?u=4&show=all&g=mods ????

How can I force them just to have one, and if they write all of them, show some kind of error message, or perhaps redirect to the list of all as a default "member.php" -page ??
What you are looking at is the logic of page design. You have to determine in what order of importance the variables will be. For instance, I'd rank the specific user link and a group link as more important than a tag that tells me to show everyone. Then it's sorting those out into the logic sections.

It's as simple as an if-then-else block, in series to construct the path of logic we decided upon above.

PHP Code:
if(count($_GET) > 0) {
  if(isset(
$_GET['u'])) {
    
// Show your member specific page
  
} elseif(isset($_GET['g'])) {
    
// Show your group specific listing
  
} elseif(isset($_GET['show'])) {
    
// Show all members or whatever page of the list you want.
  
} else {
    
// Handle the invalid input as you wish...
  
}
} else {
  
// No input, so show your default page.

__________________
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning. - Rich Cook
RobertK is offline  
Reply With Quote
The Following User Says Thank You to RobertK For This Useful Post:
Tanax (02-05-2008)