我试图解决这个问题很长一段时间,而且我一直没有成功。
有一个游戏页面(www.trevorgames.com)记录用户的统计数据和成就(例如Soul Shift Game - http://www.tremorgames.com/playgame/7235/soul-shift.html)。我想了解触发了funtino以更新服务器中的用户统计信息。
首先,我检查了它,它只记录你是否已登录,所以我做了一个虚拟的acc用于测试目的(用户:markwoods5000 Pass:12345),如果有人想帮助我。在使用Chrome开发工具时,我能够检查每次在本网站的每个游戏中完成一个级别时,它会在网络选项卡中生成一个新条目,如下所示
curl "http://www.tremorgames.com/achievements/record_stats.php" -H "Cookie: PHPSESSID=a5665001a2f52df60d7c670dabe3492a; tguserid=1224522; eccheck=1; uid=1224522; __utma=269348916.337017670.1426184538.1426392700.1426447408.15; __utmb=269348916.4.10.1426447408; __utmc=269348916; __utmz=269348916.1426188456.2.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not"%"20provided)" -H
"Origin: http://www.tremorgames.com" -H
"Accept-Encoding: gzip, deflate" -H
"Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4" -H
"User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36" -H "Content-Type: application/x-www-form-urlencoded" -H "Accept: */*" -H
"Referer: http://www.tremorgames.com/games/files/1362598225_7235_SoulShift.swf" -H "X-Requested-With: ShockwaveFlash/17.0.0.134" -H
"Connection: keep-alive" --data
"StatValue=54&StatName=Stars"%"20Earned&Key=556f8db3f82c9613090b5d59cc715c4f&GameID=209&PlayerName=marcossilva"%"5F604" --compressed
我有几个问题。
我想知道如何计算Key=556f8db3f82c9613090b5d59cc715c4f
我想知道调用函数来更新服务器上的状态(所以我可以弄清楚如何计算密钥)
我想知道makePOSTRequest(代码如下)是否已用于更新服务器上的信息。
function makePOSTRequest(url, parameters, SpanName) {
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}
http_request.onreadystatechange = function() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
//alert(http_request.responseText);
result = http_request.responseText;
document.getElementById(SpanName).innerHTML = result;
//document.getElementById('status').innerHTML = 'Ready';
} else {
alert('There was a problem with the request.');
}
}
};
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
}