Jump to content

Archived

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

WhiteHawk

getting addres bar vars

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
I looked through that but guess I didn't twig to it lol, nvm

cheers, that should solve my problem.

Share this post


Link to post
Share on other sites
you can use the parse_str function to separate all you're vars if I think that's what you want to do


[code]print_r(parse_str($_SERVER['REQUEST_URI']));[/code]

Share this post


Link to post
Share on other sites

×

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.