![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 29 Pomógł: 0 Dołączył: 22.07.2003 Ostrzeżenie: (0%) ![]() ![]() |
[php:1:37062781e2]<?
function printliczba ($numer) { $liczbacyfr=1; $1 = $numer; while ($1 >=10) { $liczbacyfr++ $1=floor($1/10); } header("Content-type: image/gif"); for ($i=$liczbacyfr; $i>=1; $i--) { $cyfra = floor($numer % pow(10,$1-1)); $numer = $numer % pow(10,$i-1); $rysunekcyfra = imagecreatefromgif ("cyfry/$cyfra.gif"); imagedestroy ($rysunekcyfra); } imagegif ($rysunek); } if (!(file_exists("licznik.txt"))) $plik = fopen ("licznik.txt", "w+"); fpust ($plik, "-"); fclose ($plik); } printliczba (filesize ("dane/licznik.txt")); $plik = fopen ("licznik.txt", "a"); flock ($plik, 2); fpust ($plik, "-"); flock ($plik, 3); fcoles ($plik); ?>[/php:1:37062781e2] Oto kod, w którym jest zapisany licznik. Na stronie jest tylko komenda IMG SRC i licznik.php i pow9nien wstawiac rysunek z licznikiem. Dlaczego tak nie jest?(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif) (IMG:http://forum.php.pl/style_emoticons/default/angrysmiley.gif) (IMG:http://forum.php.pl/style_emoticons/default/angrysmiley.gif) (IMG:http://forum.php.pl/style_emoticons/default/angrysmiley.gif) |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 42 Pomógł: 0 Dołączył: 5.11.2003 Ostrzeżenie: (0%) ![]() ![]() |
Czesc!
Zobacz sobie to (zadanie na kolokwium musialem zrobic): Kod <?
class counter { var $font; var $font_size; var $txt; var $coun; function add($file_name="visit.txt",$mode="r+") { $fp=fopen ($file_name, $mode); flock($fp, 1); $count=fread ($fp, 4096); $count += 1; $this->coun= $count; fseek($fp,0); fputs($fp, $count); flock($fp, 3); fclose($fp); } function conf($font,$font_size) { $this->font= $font; $this->font_size= $font_size; $this->txt= $this->coun; } function image() { $dim= imagettfbbox($this->font_size, 0, $this->font, $this->txt); $min_x= min($dim[0], $dim[2], $dim[4], $dim[6]); $max_x= max($dim[0], $dim[2], $dim[4], $dim[6]); $width= $max_x-$min_x+3; $min_y= min($dim[1], $dim[3], $dim[5], $dim[7]); $max_y= max($dim[1], $dim[3], $dim[5], $dim[7]); $height= $max_y-$min_y+3; $img= imagecreate($width, $height); $bgcolor= imagecolorallocate($img, 224, 224, 224); $txtcolor= imagecolorallocate($img, 0, 0, 0); imagettftext($img, $this->font_size, 0, -$min_x+$dim[0], -$min_y+$dim[1], $txtcolor, $this->font, $this->txt); header("Content-type: image/png"); imagepng($img); imagedestroy($img); } } ?> <? $counter= new counter; $counter->add(); $counter->conf("arial.ttf",'20'); $counter->image(); ?> licznik korzystajacy z dowolnej czcionki |
|
|
![]() ![]() |
![]() |
Aktualny czas: 4.10.2025 - 21:44 |