Try to explain the problem. There might be another solution to it.
You can block access by sending some kind of key or signal pre opening the motd. And that key/signal is valid once. It's complicated but doable if you control the webpage that you're linking to.
Try to explain the problem. There might be another solution to it.
You can block access by sending some kind of key or signal pre opening the motd. And that key/signal is valid once. It's complicated but doable if you control the webpage that you're linking to.
Well, as Black Rose said, it could be complicated.
You need your game server to request a key from the web server that displays the page. The web server will then generate a key and make it valid for a few seconds and return that key to your game server, which you are going to use as an URL parameter when displaying a page.
It's just one of the ways that came to my mind. They are still going to have page's URL, but they won't be able to access the page unless you serve it to them.
You could do it with SQL of course. But I'm not very good at that so I'll leave that to someone else or get back to that when I got more time.
You also could merge the two php files into one index if you want to. But I'm going to bed now.
AMXX
Code:
#include <amxmodx>#include <http2>newconst KEY[]="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
newconst gPassword[]="DonkeyPunch"new gDownload[33];
new gKey[33][6];
public plugin_init(){register_plugin("Test Plugin 5", "", "[ --{-@ ]");
register_clcmd("test1", "test1");
}public test1(id){new motd[128], SteamID[32];
get_user_authid(id, SteamID, charsmax(SteamID));
formatex(motd, charsmax(motd), "http://DivinityX.eu/forums/AM/auth/get.php?SteamID=%s&Key=%s", SteamID, gKey[id]);
show_motd(id, motd);
set_task(1.0, "EnableMOTD", id);
}public client_putinserver(id)
EnableMOTD(id);
public client_disconnect(id)
DisableMOTD(id);
public EnableMOTD(id){for(new i ; i < charsmax(gKey[]) ; i++)
gKey[id][i]= KEY[random(sizeof KEY)];
new SteamID[32];
get_user_authid(id, SteamID, charsmax(SteamID));
HTTP2_AddPostVar("SteamID", SteamID);
HTTP2_AddPostVar("Key", gKey[id]);
HTTP2_AddPostVar("Password", gPassword);
gDownload[id]= HTTP2_Download("http://DivinityX.eu/forums/AM/auth/post.php", _, "CompleteHandler", "Dummy", _, REQUEST_POST);
}stock DisableMOTD(id){
gKey[id][0]=0;
new SteamID[32];
get_user_authid(id, SteamID, charsmax(SteamID));
if( gDownload[id])
HTTP2_Abort(gDownload[id]);
HTTP2_AddPostVar("SteamID", SteamID);
HTTP2_AddPostVar("Password", gPassword);
HTTP2_Download("http://DivinityX.eu/forums/AM/auth/post.php", _, "CompleteHandler", "Dummy", _, REQUEST_POST);
}public CompleteHandler(index, error){if( error )return;
new data[1024], len;
HTTP2_getData(data, charsmax(data), len);
new id;
for(new i ; i < sizeof gDownload ; i++)if( gDownload[i]== index )
id = i;
if(!is_user_connected(id))return;
gDownload[id]=0;
}public Dummy(index){}