Jump to content

Check where POST data came from?


Prismatic

Recommended Posts

On my forums i'm developing I dont want to allow anyone to send any POST data from any off-site sources. What would be the best method to thwart this?

If it helps to check against these, my config holds the following information

[code]
//Cookie Settings
$CookieDomain =".mysite.com";

//Board Header Information.
$SiteName = "MySite"; //Appears at the start of top links, IE. [Site Name] Board Name >> ...
$SiteURL = "http://www.mysite.com"; //Link for SiteName

$BoardName = "My Boards"; //Appears at the start of top links, IE. [Site Name] Board Name >> ...
$BoardURL = "http://www.MySite.com/Boards/"; //Link for BoardName
[/code]
Link to comment
https://forums.phpfreaks.com/topic/14738-check-where-post-data-came-from/
Share on other sites

I do that anyway, I just want to make sure they arn't sending a modified post from their own server.


And when I say post, I mean $_POST[''], not post as in a message to the forums, as I might have implied in the origonal post. Modified origonal post to clarify.
if a user logs in, and presses the button to reply, you can generate a random encrypted code. Only their message-post with this encrypted code should be accepted. It not fully waterproof, but it will keep away a lot of these 'off-site' posted data.
When you generate the form, INSERT a row with a Unique MD5 Hash, their Member ID and the date. Put the MD5 Hash in a hidden field, aswell as the date.
Then, on the receiving page, check that the Hash is valid, that it matches the User_id that created it and that too much time has not elapsed.
If this is scripts where people are going to be posting a topic/reply, you'll want to make sure that the time limit is quite long. Also, i would make sure you dont just give an error, make sure you return their orginal text incase someone was typing something long and loses it.

Archived

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

×
×
  • 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.