Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.