<?php
date_default_timezone_set ("Europe/Amsterdam"); // Server time
require './global.php';
require './includes/class_dm.php';
require './includes/class_dm_threadpost.php';
require './includes/functions_databuild.php';
$threaddm = new vB_DataManager_Thread_FirstPost($vbulletin, ERRTYPE_STANDARD);
$post_userid = 0; // Guest
$userid = 0; // No user
$user_name = $_POST['name'] . ' (SA-MP)';
$allow_smilie = '1';
$visible = '1';
$forum_id = !!!!!CHANGE_ME!!!!!; // Set the board id here. For example, my 'report discussions' board is ID 28, so I'd put 28. forum/forumdisplay.php?28-Report-discussion (28 is the ID)
//Thread post formatting
$post_text = (string)strip_tags('In-game name:[indent] ' . $_POST['name'] .'[/indent]
Server time:[indent] ' . strftime("%l:%M:%S %p") . ' [/indent]
Explanation:[indent]' . (string)strip_tags($_POST['posttext']) . '[/indent]');
//$_POST['posttext'] - posttext is what is sent in-game
//format(string, sizeof(string), "name=%s&posttext=%s", name, params);
//Thread title formatting
//$title = 'New post from in-game';
$title = '[' . strftime("%H:%M:%S") . '] Report from ' . $_POST['name'];
$threaddm->do_set('forumid', $forum_id);
$threaddm->do_set('postuserid', $post_userid);
$threaddm->do_set('userid', $userid);
$threaddm->do_set('username', $user_name);
$threaddm->do_set('pagetext', $post_text);
$threaddm->do_set('title', $title);
$threaddm->do_set('allowsmilie', $allow_smilie);
$threaddm->do_set('visible', $visible);
$threaddm->save();
build_forum_counters($forum_id);
die("Report posted!");
?>
#include a_http
new string[128];
new name[32];
GetPlayerName(playerid, name, 32);
format(string, sizeof(string), "name=%s&posttext=%s", name, params);
HTTP(playerid, HTTP_POST, "link-to-post_from_ingame.php-file", string, "MyHTMLError");
if(Kills[playerid] == 500) format(string, sizeof(string), "name=%s&kills=%d", name, Kills[playerid]);
$post_text = (string)strip_tags('' . $_POST['name'] . ' just got 500 kills!
Well done to him!'); // Thread post
$title = '[' . strftime("%H:%M:%S") . '] - ' . $_POST['name'] . ' just got 500 kills!'; // Thread title
forward MyHTMLError(index, response_code, data[]);
public MyHTMLError(index, response_code, data[])
{
new
buffer[ 128 ];
if(response_code == 200) //Did the request succeed?
{
//Yes!
format(buffer, sizeof(buffer), "%s", data);
SendClientMessage(index, 0xFFFFFFFF, buffer);
}
}
define('SKIP_REFERRER_CHECK', true);
I do have money to buy a domain, actually; we've had to migrate hosts twice because of bandwidth usage so we're not buying a set domain until we know we're staying.
And yes, it is insecure, but until I find a way to whitelist an IP as a POST referrer, it's going to have to be insecure. As long as it's not made blatantly clear that there's no protection against POST data, people aren't going to try to send POST requests. That's like me putting in random credit card numbers. It can work in my favour, but it's not very likely unless someone gives the details out. |