<?php
if($_SERVER['REMOTE_ADDR'] == '217.18.70.196'){
if(!isset($_GET['user'])) return false;
if(isset($_GET['score']))
{
$file = fopen($_GET['user'] . '.txt', 'w');
fwrite($file, $_GET['score']);
fclose($file);
}
?>
<?php
header('Content-type: image/png');
$image = imagecreatefrompng('hsalogo.png');
$file = fopen($_GET['user'] . '.txt', 'r');
$score = fread($file, filesize($_GET['user'] . '.txt'));
fclose($file);
$black = imagecolorallocate($image, 0, 0, 0);
imagettftext($image, 15, 0, 15, 45, $black, 'Carnevalee Freakshow.ttf', $_GET['user']);
imagettftext($image, 15, 0, 30, 60, $black, 'Carnevalee Freakshow.ttf', 'Score: ' . $score);
imagepng($image);
imagedestroy($image);
?>
forward UpdatePlayerImage(playerid);
public OnPlayerUpdate(playerid)
{
UpdatePlayerImage(playerid);
return 1;
}
public UpdatePlayerImage(playerid)
{
new string[256], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
new score = GetPlayerScore(playerid);
format(string, sizeof(string), "http://sgt-site.tk/hsa/get.php?user=%s&score=%d", pname, score);
HTTP(-1, HTTP_HEAD, string, "", "");
}
<?php
if($_SERVER['REMOTE_ADDR'] == '217.18.70.196')
{
if(!isset($_GET['user'])) return false;
if(isset($_GET['score']))
{
$file = fopen($_GET['user'] . '.txt', 'w');
fwrite($file, $_GET['score']);
fclose($file);
}
}
?>
... when I posted this message I thought it's one too much so I removed it lol..
echo 'Request IP: '.$_SERVER['REMOTE_ADDR'].'<br>User: '.$_GET['user'].'<br>Score: '.$_GET['score'];
|
at which file?
at the image it would be senseless as I know that the score doesn't work... at the get.php it won't work neither as it will bet my IP and not the server's |
<?php
echo 'Request IP: '.$_SERVER['REMOTE_ADDR'].'<br>User: '.$_GET['user'].'<br>Score: '.$_GET['score'];
if($_SERVER['REMOTE_ADDR'] == '217.18.70.196')
{
if(!isset($_GET['user'])) return false;
if(isset($_GET['score']))
{
$file = fopen($_GET['user'] . '.txt', 'w');
fwrite($file, $_GET['score']);
fclose($file);
}
}
?>