Is this script safe enough from sql injections? Or is it possible to improve it more efficiently? Because i am going to use it in public and don't know about this line "mysql_real_escape_string($_GET['user_id']);" Perhaps its possible to improve it more.
<?
$id = mysql_real_escape_string($_GET['id']);
if ($id == 1)
{
$userinfo['user_id'] = mysql_real_escape_string($_GET['user_id']);
$info = $db->fetchArray("SELECT points FROM ". PREFIX ."list WHERE user_id = '{$userinfo['user_id']}'");
if (!empty($info))
{
$user_rank = UserRank($userinfo['user_id']);
header('Content-type: image/png');
$points = $info['server_points'];
$line = "empty";
$nr = "Number";
$font = 3;
$font2 = 2;
$width = ImageFontWidth($font)* strlen($nr) ;
$width2 = ImageFontWidth($font)* strlen($points);
$height = ImageFontHeight($font);
$im = ImageCreateFrompng(SYS_USER .'/banner.png');
$points_text_color = imagecolorallocate($im, 225, 100, 112);
$nr_text_color = imagecolorallocate ($im, 217, 153, 101);
$line_color = imagecolorallocate ($im, 100, 123, 134);
imagestring ($im, $font, 40, 18, $points, $points_text_color);
imagestring ($im, $font2, 40, 11, $line, $line_color);
imagestring ($im, $font2, 40, 4, $nr, $nr_text_color);
imagestring ($im, $font, 60, 4, $user_rank, $nr_text_color);
imagepng($im);
}
}