Skip to content
Advertisement

A newbie PHP question – hiding PHP variables from URL

I’m creating a feature for a game and came up with a problem I can’t solve on my own. I made an image generator to show the top dogs of guilds from a JS based Discord bot, the script which generates the image is made with PHP and it’s on my server. I’d like to be able to call this script, without the resulting URL showing all the details – at the moment it looks like this after a call:

http://www.scam.fi/aow/im.php?m=NBA_-_TOP_3&b=ArkA&c=lenipeni&d=Sandwich&1=7334&2=6978&3=6682

(Don’t be afraid of the domain name, I named my Internet storage unit badly). While all those variables are visible, that creates a problem for me since the results are pretty easily modified by anyone. Is there some way I could hide the variables with MOD rewrite or is there some other way?

Advertisement

Answer

Is there some way I could hide the variables with MOD rewrite

No. The data, with the approach you are taking, needs to get into the script from the browser.

or is there some other way?

Store the data in a database. Associate it with an ID. Put the ID in the URL.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement