Disable URL change via URL bar

Reply

Join Date: Jan 2007
Posts: 9
Reputation: loopylouis is an unknown quantity at this point 
Solved Threads: 0
loopylouis loopylouis is offline Offline
Newbie Poster

Disable URL change via URL bar

 
0
  #1
Jan 10th, 2007
Hi i own an online game and i wish to know weather there is a way to disable my members from changing the URL in the url bar and only allow them to click links. If they change the URL in the url bar i would like it to header/re-direct to the index.php or session_destory();

I would like my game to only be navigational by the links provided. I have over 100 scripts on my server so it would be pointless blocking each script using the referer.

Any ideas?:cheesy:
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Disable URL change via URL bar

 
0
  #2
Jan 10th, 2007
Can't be done. You can't control the browser like that. The closest you could come is to use javascript to pen your site in a window and remove the URL bar but that is a bad solution. It will confuse users and leave a lot of them locked out from your site completely.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 138
Reputation: php_daemon is an unknown quantity at this point 
Solved Threads: 2
php_daemon php_daemon is offline Offline
Junior Poster

Re: Disable URL change via URL bar

 
0
  #3
Jan 10th, 2007
Well, if you made a completely AJAX driven user interface, it would be possible. However, that also means that search engines cannot crawl your site. And you know what that means.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 2
Reputation: c0rkscrew is an unknown quantity at this point 
Solved Threads: 0
c0rkscrew c0rkscrew is offline Offline
Newbie Poster

Re: Disable URL change via URL bar

 
0
  #4
Jan 10th, 2007
Well, I'm currently developing a game myself and here is what I have done to prevent this.

  1. $root = 'yoursite.com';
  2. //Check For Authorized Entry
  3. if (!eregi($root, $webserver['Referer'])) {
  4. echo "Unauthorized Access";
  5. //Just forward to error page.
  6. } else {
  7. //Continue Loading Page Here
  8. }

Just put the code above in a file and include it on every page except your index page and you're good to go. If you don't want to manually include it in every page, just place an include statement in a page that you currently include on every page (i.e., security.inc).

Hope that helps.
Reply With Quote Quick reply to this message  
Join Date: Sep 2005
Posts: 1,073
Reputation: digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice digital-ether is just really nice 
Solved Threads: 66
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Veteran Poster

Re: Disable URL change via URL bar

 
0
  #5
Jan 15th, 2007
Originally Posted by loopylouis View Post
Hi i own an online game and i wish to know weather there is a way to disable my members from changing the URL in the url bar and only allow them to click links. If they change the URL in the url bar i would like it to header/re-direct to the index.php or session_destory();

I would like my game to only be navigational by the links provided. I have over 100 scripts on my server so it would be pointless blocking each script using the referer.

Any ideas?:cheesy:
Its always better to solve problems server side than having to rely on disabling something on the browser...
It would be even better if the game scripts were written so the rule of the games apply no matter what is sent from the browser (ie: a user created url would be invalid in the game since it would break the rules of the game. But if they do put in a valid url through the address bar, then its still part of the game.. )
This is true for any server side scripting, game.. business logic.. regular website, CMS etc....

Solutions relying on teh browser will work, but will be see through for anyone who wants to cheat..
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC