Jump to content

getting addres bar vars


WhiteHawk

Recommended Posts

Basically I'm building a php MMORPG or online game, now I have hit a small snag...

in order ot stop players cheating I have produced a large number of logs. n.p.

however one of the things I want to include is the address of the page that its currently on.

No problem you say...

[blockquote]$address = $_SERVER['PHP_SELF'];[/blockquote]

or

[blockquote]$address = __FILE__;[/blockquote]

unfortunately this doesn't store all I need it to. lets say for instance we're on train.php if we use any of the above methods it will work fine.

but if we're on train.php?step=pie then it will drop the vars and I'll just end up with train.php in the $address.

The idea is if someone was trying to cheat, e.g. train.php?step=pie&money=-1000 or something then it would be able to get the whole address so that when its inserted into the log I can see how people are modding any get vars that are used.

any help would be appreciated.

WhiteHawk.
Link to comment
Share on other sites

Tehehe actually ran into this today trying to work that same problem backwards

Try

$var1 = $_SERVER['PHP_SELF'];
$var2 = $_SERVER['SCRIPT_NAME'];
$var3 = $_SERVER['REQUEST_URI'];

Errr one of those three should do it, URI I believe


Side note
$var3 = $_SERVER['REQUEST_URI'];

Should be what you are looking for

Then if you need to strip off the extra what I used was ereg() though I am not sure if that is the best solution
Link to comment
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.