1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
|
<?PHP
require("./global.php");
$result=$db->query("SELECT * FROM cc".$n."_countries WHERE x='$x' ORDER BY y ASC");
$free=$db->query("SELECT * FROM cc".$n."_crand WHERE x='$x' AND used='0' ORDER BY y ASC");
$countOfRes=$db->num_rows($result)+$db->num_rows($free);
if ($countOfRes % 4) {
$add = 1;
}
$imy = (int) ($countOfRes/4+$add)*60;
$ds = 1;
$image = imagecreatetruecolor(600, $imy);
$bgimg = imagecreatefromjpeg("images/kartebg.jpg");
$land1 = imagecreatefrompng("images/land1.png");
$land2 = imagecreatefrompng("images/land2.png");
$land3 = imagecreatefrompng("images/land3.png");
$land4 = imagecreatefrompng("images/land4.png");
imagecolortransparent($land1, imagecolorat($land1, 1, 1));
imagecolortransparent($land2, imagecolorat($land2, 1, 1));
imagecolortransparent($land3, imagecolorat($land3, 1, 1));
imagecolortransparent($land4, imagecolorat($land4, 1, 1));
$blk = imagecolorallocate($image, 0, 0, 0);
$wht = imagecolorallocate($image, 200, 200, 200);
imagecopyresized($image, $bgimg, 0, 0, 0, 0, 600, 796, 600, 796);
imagecopyresized($image, $bgimg, 0, 796, 0, 0, 600, 796, 600, 796);
$x=0;
$y=0;
while($row=$db->fetch_array($result)) {
$allires=$db->query("SELECT allianzid FROM cc".$n."_users WHERE userid='$row[userid]'");
$alli=$db->fetch_array($allires);
$alliname=allianz($alli['allianzid']);
if (!$alliname) {
$alliname="Keine Allianz";
}
$username_r=username($row['userid']);
$row['name']=b_trim($row['name']);
$array="ä:ä|Ä:Ä|ö:ö|Ö:Ö|ü:ü|Ü:Ü";
$bit=explode("|",$array);
for($i=0;$i<count($bit);$i++) {
$space=explode(":",$bit[$i]);
$username_r=str_replace($space[0],$space[1],$username_r);
$row['name']=str_replace($space[0],$space[1],$row['name']);
}
$bx = rand(-25,25);
$by = rand(-5,5);
if ($row['picid']==1) {
imagecopyresized($image, $land1, ($x+25+$bx), $y+5+$by, 0, 0, 50, 50, 50, 50);
} elseif ($row['picid']==2) {
imagecopyresized($image, $land2, ($x+25+$bx), $y+5+$by, 0, 0, 50, 50, 50, 50);
} elseif ($row['picid']==3) {
imagecopyresized($image, $land3, ($x+25+$bx), $y+5+$by, 0, 0, 50, 50, 50, 50);
} elseif ($row['picid']==4) {
imagecopyresized($image, $land4, ($x+25+$bx), $y+5+$by, 0, 0, 50, 50, 50, 50);
}
imagestring($image, 2, ($x+5+$ds), ($y+$ds), $username_r, $wht);
imagestring($image, 2, ($x+5+$ds), ($y+10+$ds), $row['name'], $wht);
imagestring($image, 2, ($x+5+$ds), ($y+20+$ds), $alliname, $wht);
imagestring($image, 2, ($x+5+$ds), ($y+30+$ds), $row['x'].":".$row['y'], $wht);
imagestring($image, 2, ($x+5+$ds), ($y+40+$ds), "$row[points] Punkte", $wht);
imagestring($image, 2, ($x+5), ($y), $username_r, $blk);
imagestring($image, 2, ($x+5), ($y+10), $row['name'], $blk);
imagestring($image, 2, ($x+5), ($y+20), $alliname, $blk);
imagestring($image, 2, ($x+5), ($y+30), $row['x'].":".$row['y'], $blk);
imagestring($image, 2, ($x+5), ($y+40), "$row[points] Punkte", $blk);
$x += 150;
if ($x >= 600) {
$x = 0;
$y += 60;
}
}
while($row=$db->fetch_array($free)) {
imagestring($image, 2, ($x+5+$ds), ($y+10+$ds), "Freie Fläche", $wht);
imagestring($image, 2, ($x+5+$ds), ($y+20+$ds), $row['x'].":".$row['y'], $wht);
imagestring($image, 2, ($x+5), ($y+10), "Freie Fläche", $blk);
imagestring($image, 2, ($x+5), ($y+20), $row['x'].":".$row['y'], $blk);
$x += 150;
if ($x >= 600) {
$x = 0;
$y += 60;
}
}
imagestring($image, 2, 500+$ds, $imy-15+$ds, "bildtext1", $wht);
imagestring($image, 2, 500, $imy-15, "bildtext2", $blk);
header('Content-Type: image/jpeg');
imagejpeg($image, "", 70);
imagedestroy($image);
imagedestroy($kartebg);
imagedestroy($land1);
imagedestroy($land2);
imagedestroy($land3);
imagedestroy($land4);
?>
|