PHP Code:
<?php
if(session_id()=="") session_start();
function getLevelByXp($xp){
$listlevel=array(0,40,60,100,200,350,550,800,1113,1504,1993,2604,3368,4323,5517,7010,8876,11209,13659,16232,18934,21771,24750,27878,31162,34610,38230,42031,46022,50213,54614,59235,64087,69182,74532,80150,86049,92243,98747,105576,112746,120275,128180,136480,145195,154346,163955,174044,184637,195760,207439,219702,232578,246098,260294,275200,290851,307285,324541,342660,361685,381661,402636,424660,447785,472066,497561,524331,552440,581954,612944,645484,679651,715526,756782,804226,858787,921532,993689,1076670,1172098,1281840,1408043,1553176,1720079,1912017,2132746,2386584,2678498,3014199,3400255,3844219,4354778,4941921,5617135,6393631,7286601,8313517,9494470,2016089205);
$j=count($listlevel);
for($i=0;$i<$j;$i++){
if($listlevel[$i] > $xp) break;
}
return $i;
}
if(isset($_POST['flashVersion']) and !empty($_POST['flashVersion'])) $_SESSION['swversi']=$_POST['flashVersion'];
$versi="1.4.43";
if(isset($_SESSION['swversi'])) $versi=$_SESSION['swversi'];
$str = '<html><head><title>Social Wars</title></head><body>
<form method="post">
ID FB:<br/>
<input name="fbid" /><br/>
Flash Version:<br/>
<input name="flashVersion" value="'.$versi.'"/><br/>
Cash:<br/>
<input name="cash" value="0"/><br/>
XP:<br/>
<input name="xp" value="0"/><br/>
Gold:<br/>
<input name="gold" value="0"/><br/>
Wood:<br/>
<input name="wood" value="0"/><br/>
Oil:<br/>
<input name="oil" value="0"/><br/>
Steel:<br/>
<input name="steel" value="0"/><br/>
<input type="submit" value="Submit" />
</form>';
if(isset($_POST['fbid']) and isset($_POST['xp']) and isset($_POST['cash']) and isset($_POST['gold']) and isset($_POST['wood']) and isset($_POST['oil']) and isset($_POST['steel'])){
if(empty($_POST['fbid'])) die('FB ID tidak boleh kosong.');
$result=komut("http://dynamicmw.socialpointgames.com/appsfb/menvswomen/srvsexwars/get_player_info.php?USERID=$_POST[fbid]&spdebug=1");
$payload = explode(';',$result);
$data = json_decode($payload[1],true);
$xp = $data['map']['xp'];
$str .= "name: ".$data['playerInfo']['name']."<br/>";
$str .= "cash: ".number_format($data['playerInfo']['cash'],0,',','.');
$str .= ", xp: ".number_format($xp,0,',','.');
$str .= ", level: ".$data['map']['level']."<br/>";
$str .= "gold: ".number_format($data['map']['gold'],0,',','.');
$str .= ", oil: ".number_format($data['map']['oil'],0,',','.');
$str .= ", wood: ".number_format($data['map']['wood'],0,',','.');
$str .= ", steel: ".number_format($data['map']['steel'],0,',','.')."<br/>";
$str .= "------------------------------<br/>";
$i=(integer)$_POST['xp']+(integer)$_POST['gold']+(integer)$_POST['wood']+(integer)$_POST['oil']+(integer)$_POST['steel']+(integer)$_POST['cash'];
if($i==0) die("$str</body></html>");
$cmd[]=array(0,'set_variables',array(),array(0,(integer)$_POST['xp'],(integer)$_POST['gold'],(integer)$_POST['wood'],(integer)$_POST['oil'],(integer)$_POST['steel'],(integer)$_POST['cash'],0));
$xp+=(integer)$_POST['xp'];
if($xp<0) $xp=0;
$nlevel = getLevelByXp($xp);
if((integer)$data['map']['level']!=$nlevel){
$cmd[]=array(0,'level_up',array($nlevel),array(0,0,0,0,0,0,0,0));
}
$datastr=json_encode(array('publishActions'=>"1",'commands'=>$cmd,'flashVersion'=>$_POST['flashVersion'],'first_number'=>1,'tries'=>1,'ts'=>time(),'accessToken'=>""));
$hash = hash_hmac('sha256',$datastr,'3m0d3pwiupoetn7ysa02');
$postdata=http_build_query(array('data'=>$hash.';'.$datastr));
komut("http://dynamicmw.socialpointgames.com/appsfb/menvswomen/srvsexwars/command.php?USERID=$_POST[fbid]&spdebug=1",$postdata);
$result=komut("http://dynamicmw.socialpointgames.com/appsfb/menvswomen/srvsexwars/get_player_info.php?USERID=$_POST[fbid]&spdebug=1");
$payload = explode(';',$result);
$data = json_decode($payload[1],true);
$str .= "name: ".$data['playerInfo']['name']."<br/>";
$str .= "cash: ".number_format($data['playerInfo']['cash'],0,',','.');
$str .= ", xp: ".number_format($data['map']['xp'],0,',','.');
$str .= ", level: ".$data['map']['level']."<br/>";
$str .= "gold: ".number_format($data['map']['gold'],0,',','.');
$str .= ", oil: ".number_format($data['map']['oil'],0,',','.');
$str .= ", wood: ".number_format($data['map']['wood'],0,',','.');
$str .= ", steel: ".number_format($data['map']['steel'],0,',','.')."<br/>";
$str .= "------------------------------<br/>";
die("$str</body></html>");
}else die("$str</body></html>");
function fakeip()
{
return long2ip( mt_rand(0, 65537) * mt_rand(0, 65535) );
}
function komut($url,$args=false)
{
global $fbid,$user;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: ".fakeip(),"X-Client-IP: ".fakeip(),"Client-IP: ".fakeip(),"HTTP_X_FORWARDED_FOR: ".fakeip(),"X-Forwarded-For: ".fakeip()));
if($args)
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$args);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8888");
$result = curl_exec ($ch);
curl_close ($ch);
return $result;
}
?>