statistics shown in graphics statistics shown in graphics
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

statistics shown in graphics

Started by xplicit, August 31, 2004, 11:27:11 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

xplicit

I just worked out a little script add on and want to share it with you.

(this is based on the functions of ssi.php or likewise functions, if you don't knwo how to use them this add on is just not for you)

The idea is the following I wanted my stats outside of the usual album stats so I could display it on the right menu bar of my page. The solution for that is using something like the ssi.php script or another scripts which connects to the sql database. I used a modified ssi.php script but I will show this example using a ssi.php function. Using these functions and gave the statistics in just plain text. I wanted it a bit more sophisticated so I decided to show the statistics in its graphical representation. The script is very simple



for ($digits = 0 ;$digits < strlen($variable) ; $digits++)
{
$imgsrc = substr($variable,$digits ,1);
echo "<img src =\"/digitdirectory/" . $imgsrc . ".imagetype \">";
}



This is what is does: it determines the number of digits in the variable. Each digit in the string will be the name of the graphical representation.

/digitdirectory/ is the directory your images are strored in. these images must have names like 0.xxx, 1.xxx, 2.xxx etcetra
the xxx can be gif, png, jpg etcetera.

.imagetype must be replaced by something like .gif, .png, .jpg etc.

To show the example I will give an example of a piece of ssi.php with the script in it so you can see how it COULD be used.



function cpg_total_comments()
{
GLOBAL $CONFIG,$cpg_decimal_point,$cpg_thousands_separator;
  $query = "SELECT count(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE 1";
  $result = mysql_query($query);
  $nbEnr = mysql_fetch_array($result);
  $comments_count = $nbEnr[0];
  mysql_free_result($result);

  for ($i = 0 ;$i < strlen($comments_count) ; $i++)
   {
   $imgsrc = substr($comments_count,$i ,1);
   echo "<img src =\"/digits/" . $imgsrc . ".gif\">";
   }
}



On the site : http://www.freehitcounters.net/ you can get over 150 templates of digit styles, just download the full digit serie of the one you want to use and put them in your digit directory.

Have fun with it and let me know if you liked/used it.

Xplicit
Don't ask me: Can you do this .... or Give me that...or I need Quick help in PM's. I'm not Santaclaus so post your questions on the board so it will be in the benefit for everyone.

foryou

enter : http://www.freehitcounters.net/


and ..... detected: Trojan program Trojan-Downloader.HTML.Agent.c - URL: http://traff.step57.com/mrx/
:'(