Jump to content

php case switch help


jas4

Recommended Posts

Hi,

 

I'm implemening an update profile section on my site and I'd like to use switch/case method. e.g. page.com?update=success or page.com?update=failure, when I use the $_GET['update'] it works fine, however what of someone changes the url manually to .com?update=somethingelse ?

 

How can I stop people getting access to other pages/cases manually

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/65048-php-case-switch-help/
Share on other sites

Just test like so:

if($_GET['update'] == "success") 
  // Do success stuff here.
else 
  // Assume it failed! Print error message or whatever.

Or if you want to be funny:

if($_GET['update'] == "success") 
  // Do success stuff here.
elseif($_GET['update'] == "failure")
  // It failed! Print error message or whatever.
else 
  echo "Stop hacking! Your IP ".$_SERVER['REMOTE_ADDR']." has been logged.";

Hehehe... ;D (1 @/\/\ teh 1337 hax0r!)

Link to comment
https://forums.phpfreaks.com/topic/65048-php-case-switch-help/#findComment-324611
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.