Hallo,
kann mir jemand zufällig verraten, warum mein PHP Script nicht funktioniert?
Er wiedergibt die ganze Zeit, dass die Datei nicht angezeigt werden kann, weil Sie fehler enthält.
Code
<?
error_reporting(E_ALL);
ini_set('display_errors', 1);
$MySQL['host'] = "localhost";
$MySQL['username'] = "-";
$MySQL['password'] = "-";
$MySQL['db_name'] = "-";
mysql_connect($MySQL['host'], $MySQL['username'], $MySQL['password'])or die(mysql_error());
mysql_select_db($MySQL['db_name'])or die(mysql_error());
header('Content-Type: image/png');
$signaturQuery = mysql_query("SELECT * FROM script_accounts WHERE Admin != 0 ORDER BY Admin DESC");
while($row = mysql_fetch_array($signaturQuery))
{
$admins[] = $row;
}
$line_background = ImageCreateFromPNG("Offline.png");
$line_height = ImageSY($line_background);
$line_height_margin = 0;
$currentHeight = $line_height_margin;
$image_height = $line_height*sizeof( $admins ) + $line_height_margin*sizeof( $admins );
$img = ImageCreate( ImageSX( $line_background ), $image_height );
$transparent = ImageColorAllocate( $img, 245, 245, 245 );
ImageColorTransparent( $img, $transparent );
$weiß = ImageColorAllocate( $img, 255, 255, 255);
foreach( $admins as $admin ) {
if($admin["Online"] == 1) {
$line_background = ImageCreateFromPNG("Online.png");
} else if($admin["Online"] == 0) {
$line_background = ImageCreateFromPNG("Offline.png");
}
$_lastonline = date("d.m.Y",$admin["LastLogin"]);
ImageCopy($img, $line_background, 0, $currentHeight, 0, 0, ImageSX( $line_background ), ImageSY( $line_background ) );
ImageString($img, 5, 15, $currentHeight + 10, $admin["Name"], $weiß);
ImageString($img, 5, 150, $currentHeight + 10, getRank($admin["Admin"]), $weiß);
Imagestring($img, 5, 400, $currentHeight + 10, $_lastonline, $weiß);
$currentHeight = $currentHeight + $line_height + $line_height_margin;
}
ImagePNG( $img );
ImageDestroy( $img );
function getRank($admin) {
if($admin == 1) {
$adminrank = "Supporter";
} else if($admin == 2) {
$adminrank = "Moderator";
}
else if($admin == 3) {
$adminrank = "Administrator";
}
else if($admin == 4) {
$adminrank = "Head-Admin";
}
else if($admin == 5) {
$adminrank = "Projektleiter";
}
return $adminrank;
}
?>
Alles anzeigen