Mysle, ze wyciaganie z bazy i logowanie moge podarowac. Tak wiec tylko interesujaca czesc kodu.
$imgname = ('foto/button.png'); $my_img = @imagecreatefrompng($imgname); $text_colour = imagecolorallocate( $my_img, 0, 0, 0 ); $prog = imagecolorallocate($my_img, 250, 250, 210 ); if ($status == 'ok'){ $podklad = imagecolorallocate($my_img, 127, 255, 0 ); } elseif ($status == 'oczekuje') { $podklad = imagecolorallocate($my_img, 176, 196, 222 ); } elseif ($status == 'blad'){ $podklad = imagecolorallocate($my_img, 220, 20, 60 ); } imagestring( $my_img, 10, 5, 80, 'Program:', $text_colour ); imagefilledrectangle ($my_img, 1, 100, 148, 120, $prog); imagestring( $my_img, 10, 5, 101, $fullname, $text_colour ); imagerectangle ($my_img, 0, 100, 190, 120, $podklad); imagefilledrectangle ($my_img, 1, 130, 148, 150, $podklad); imagestring( $my_img, 20, 20, 132, $status, $text_colour ); imagesetthickness ( $my_img, 5 ); imagepng( $my_img ); imagecolordeallocate( $line_color ); imagecolordeallocate( $text_color ); imagecolordeallocate( $background ); imagedestroy( $my_img );
W tym kodzie instrukcja nie wykonuje sie. Tam gdzie powinien byc kolor, jest czarne tlo. Niezaleznie od tego jaka zmienna przyjmuje wartosc. Gdy usuwam instrukcje if i daje tylko jeden kolor, wszystko wyswietla sie jak nalezy. Gdzie zatem jest blad?
#########################################
Zmodyfikowalem kod, ale dalej nie dziala. Co robie nie tak?
Kod
if ($status == 'ok'){
include ('inc/ok.php');
}
elseif ($status == 'oczekuje'){
include ('inc/oczekuje.php');
}
elseif ($status == 'blad'){
include ('inc/blad.php');
}
include ('inc/ok.php');
}
elseif ($status == 'oczekuje'){
include ('inc/oczekuje.php');
}
elseif ($status == 'blad'){
include ('inc/blad.php');
}
i przyklad pliku inkludowanego
Kod
<?php
$imgname = ('foto/button.png');
$my_img = @imagecreatefrompng($imgname);
$prog = imagecolorallocate($my_img, 250, 250, 210 );
$text_colour = imagecolorallocate( $my_img, 0, 128, 128 );
$podklad = imagecolorallocate($my_img, 220, 20, 60 );
imagestring( $my_img, 10, 5, 80, 'Program:', $text_colour );
imagefilledrectangle ($my_img, 1, 100, 148, 120, $prog);
imagestring( $my_img, 10, 5, 101, $fullname, $text_colour );
imagerectangle ($my_img, 0, 100, 190, 120, $podklad);
imagefilledrectangle ($my_img, 1, 122, 148, 142, $podklad);
imagestring( $my_img, 20, 20, 124, $status, $text_colour );
imagesetthickness ( $my_img, 5 );
header( "Content-type: image/png" );
imagepng( $my_img );
imagecolordeallocate( $line_color );
imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $my_img );
?>
$imgname = ('foto/button.png');
$my_img = @imagecreatefrompng($imgname);
$prog = imagecolorallocate($my_img, 250, 250, 210 );
$text_colour = imagecolorallocate( $my_img, 0, 128, 128 );
$podklad = imagecolorallocate($my_img, 220, 20, 60 );
imagestring( $my_img, 10, 5, 80, 'Program:', $text_colour );
imagefilledrectangle ($my_img, 1, 100, 148, 120, $prog);
imagestring( $my_img, 10, 5, 101, $fullname, $text_colour );
imagerectangle ($my_img, 0, 100, 190, 120, $podklad);
imagefilledrectangle ($my_img, 1, 122, 148, 142, $podklad);
imagestring( $my_img, 20, 20, 124, $status, $text_colour );
imagesetthickness ( $my_img, 5 );
header( "Content-type: image/png" );
imagepng( $my_img );
imagecolordeallocate( $line_color );
imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $my_img );
?>
W tym wypadku wogole nic sie nie wyswietla - po prostu biala strona.