Changeset 56 for trunk/img_statistic.php
- Timestamp:
- Feb 2, 2009, 10:53:29 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/img_statistic.php
r49 r56 1 1 <?php 2 2 3 session_start(); 3 4 include('includes/config.php'); 4 5 include('includes/databaseconection.php'); 6 include('includes/global_function.php'); 5 7 6 8 // SQL injection hack protection … … 8 10 foreach($_GET as $Index => $Item) $_GET[$Index] = addslashes($_GET[$Index]); 9 11 10 // připojení do databáze12 // Open database connection 11 13 $Database = new Database($Config['Database']['Host'], $Config['Database']['User'], $Config['Database']['Password']); 12 14 $Database->SQLCommand('SET NAMES '.$Config['Database']['Charset']); 13 15 $Database->SelectDatabase($Config['Database']['Database']); 14 16 15 $TypeTexts = $_GET['TypeText']; 17 $FontFile = 'images/FRIZQT__.ttf'; 18 $TranslationTree = GetTranslationTree(); 19 $Group = $TranslationTree[$_GET['group']]; 16 20 17 // echo "SELECT count(distinct(entry)) FROM $TypeTexts WHERE Language <> '0' AND Complete = '1'"; 18 $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(distinct(entry)) FROM ".$TypeTexts." WHERE Language <> '0' AND Complete = '1'")); 19 $NumberTranslate = $ID[0]; 21 $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(distinct(entry)) FROM ".$Group['TablePrefix']." WHERE Language <> '0' AND Complete = '1'")); 22 $NumberTranslate = $ID[0]; 20 23 21 $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(*) FROM ".$TypeTexts." WHERE Language = '0'"));22 24 $ID = mysql_fetch_row($Database->SQLCommand("SELECT count(*) FROM ".$Group['TablePrefix']." WHERE Language = '0'")); 25 $NumberAJ = $ID[0]; 23 26 24 $Percent = ($NumberTranslate / $NumberAJ) * 100;25 27 if($NumberAJ > 0) $Percent = ($NumberTranslate / $NumberAJ) * 100; else $Percent = 0; 28 $Percent = substr($Percent, 0, 5); 26 29 27 28 $obrazek = imagecreatetruecolor(400, 40);29 $Color1 = imagecolorallocate($obrazek, 225, 246, 247);30 $Color2 = imagecolorallocate($obrazek, 77, 225, 251);31 $Color3 = imagecolorallocate($obrazek, 2, 9, 199);32 imagefilledrectangle($obrazek, 0, 0, 400, 39, $Color1);33 imagefilledrectangle($obrazek, 0, 0, $PercentBar, 59, $Color2);34 imagestring($obrazek, 10, 120, 5, $NumberTranslate.'/'.$NumberAJ, $Color3);35 imagestring($obrazek, 3, 300, 5, $TypeTexts, $Color3);36 imagestring($obrazek, 10, 120, 20, $Percent.' %', $Color3);37 imagestring($obrazek, 1, 240, 30, 'Aktualizace: '.date("m.d.y H:i"), $Color3);38 39 header('Content-Type: image/png');40 imagepng($obrazek); 41 imagedestroy($obrazek); 42 43 // echo '<img src="statistic.png">'; 44 30 $PercentBar = $Percent * 4; 31 $Image = ImageCreateTrueColor(400, 32); 32 $Color1 = imagecolorallocate($Image, 225, 246, 247); 33 $Color2 = imagecolorallocate($Image, 77, 225, 251); 34 $Color3 = imagecolorallocate($Image, 2, 9, 199); 35 imagefilledrectangle($Image, 0, 0, 400, 31, $Color1); 36 imagefilledrectangle($Image, 0, 0, $PercentBar, 59, $Color2); 37 $FontSize = 10; 38 ImageTTFText($Image, $FontSize, 0, 120, 13, $Color3, $FontFile, $NumberTranslate.'/'.$NumberAJ); 39 ImageTTFText($Image, $FontSize, 0, 240, 13, $Color3, $FontFile, $Group['Name']); 40 ImageTTFText($Image, $FontSize, 0, 120, 29, $Color3, $FontFile, $Percent.'%'); 41 $FontSize = 6; 42 ImageTTFText($Image, $FontSize, 0, 240, 28, $Color3, $FontFile, 'Aktualizace: '.date("m.d.y H:i")); 43 44 Header("Content-type: image/png"); 45 ImagePNG($Image); 46 ImageDestroy($Image); 47 45 48 ?>
Note:
See TracChangeset
for help on using the changeset viewer.