GET method help

Hello,
I just started coding in php and I need some help on GET method.
Can anyone make it so whenever I enter something like this
index.php?file=doc&text=123
it creates a /data/$doc.html file and types 123 in the next line So basically if this gets repeated and the file keeps adding 123 to the next line and so on. Thank you.

Well, first, you should use quotes around text, so the ?file=doc should be ?file=‘doc’ …

Next, remember that GET is not very secure and is seldom used as it let’s hackers alter your data and can cause issues when saving things into files.

And, to save the data into the file, you just use somethi> ng, loosely, like this:

$filename=filter_input(INPUT_GET, 'doc');
$filedata=filter_input(INPUT_GET, 'text');
file_put_contents($filename, $filedata, FILE_APPEND);

Not tested, just off the top of my mind…

That isn’t a get method. Use HTTP Verbs properly.

I literally have no idea about it. I simultaneously started learning HTML and PHP only because they go along together.

Astone??? Which HTTP verbs are wrong? Perhaps you should tell him the correct way if this isn’t.?.

The GET method or GET variables aren’t less secure than ie POSTing data. Care should always be taken when handling user submitted data.

The data I’m going to send is only meant for stats purposes and on public access. I’ll just hide the php in a strong name directories for a somewhat security to block spammers.

Well, I consider it less safe than POST because you can SEE the data in the URL. So, it is easier to figure out the structure of the data.

Stats of what? How about we start with what the goal is.

Stats for players on a gameserver. Gather player information along with his level name and current xp and send the data through the link. I’m not talking encryption or anything taken seriously about security.

So player stats should be coming from a database, so I am not understanding your use case.

The player would have some sort of event that happens, that makes a call to the database to insert or update a record in a table

There is no such thing. It would be naive to think you would be hiding anything.

Player’s information comes straight from player connection event on sourcepawn csgo sdk. So there’s in no database or anything to load data from. Knowing that this info is going to be public, I can’t find no other way to send data secretly unless hiding the file. It’s pretty straight since all this info that I’m gathering from it’s available from an ingame command called status. I’m only keeping it as a history, something to look back and generate visitor statistics. I hope this clears your doubts.

So how does this process work? Do they call your website or do you call theirs?

Giving a history is far easier in a database than in a file; it’s also searchable.

Game calls an event and sourcemod (a game programming language) catches that and I hook up the client connect and get his data. Then I send the data through my website and with the info given, I’m able to create a table for easy access and hardcode a calendar so other people can navigate through specific dates and such.

Hello, anyone has any ideas?

Sponsor our Newsletter | Privacy Policy | Terms of Service