WhiteHawk Posted April 6, 2006 Share Posted April 6, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/6758-getting-addres-bar-vars/ Share on other sites More sharing options...
Malkavbug Posted April 6, 2006 Share Posted April 6, 2006 Tehehe actually ran into this today trying to work that same problem backwardsTry$var1 = $_SERVER['PHP_SELF'];$var2 = $_SERVER['SCRIPT_NAME'];$var3 = $_SERVER['REQUEST_URI'];Errr one of those three should do it, URI I believeSide note$var3 = $_SERVER['REQUEST_URI'];Should be what you are looking forThen if you need to strip off the extra what I used was ereg() though I am not sure if that is the best solution Quote Link to comment https://forums.phpfreaks.com/topic/6758-getting-addres-bar-vars/#findComment-24578 Share on other sites More sharing options...
WhiteHawk Posted April 6, 2006 Author Share Posted April 6, 2006 I looked through that but guess I didn't twig to it lol, nvmcheers, that should solve my problem. Quote Link to comment https://forums.phpfreaks.com/topic/6758-getting-addres-bar-vars/#findComment-24603 Share on other sites More sharing options...
Zane Posted April 7, 2006 Share Posted April 7, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/6758-getting-addres-bar-vars/#findComment-24800 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.