php - Using isset to display page content -
i having issue using isset display content on page.
my php file called messages.php
i directing users links url: messages.php?inbox using if(isset($_get['inbox']))
{ } display users inbox. same principle other users options such compose message is: messages.php?compose
again using isset
the problem have cannot stop people manually typing stuff domain.com/messages.php
or domain.com/messages.php?somethingrandom.
is there way direct users messages.php?inbox when type in address bar isnt assigned isset?
i did try use switch couldnt seem work how ive laid out html.
an example of whole file here http://pastebin.com/sfqn2l7g
i new php , think may have gone down complicated route.
any advice appreciated.
thanks
the answer added work, having array of valid
options maybe check against later on.
$validpages = array('inbox', 'compose'); $pagefound = false; foreach ($validpages $validpage) { if (isset($_get[$validpage])) { $pagefound = true; break; } } if (! $pagefound) { header('location: /messages.php?inbox'); }
Comments
Post a Comment