Olive Branch MS Chamber of Commerce (circa Oct 1999)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

43 lines
1.0 KiB

  1. <?php
  2. // import the database configuration
  3. require("db.php3");
  4. // get values from database
  5. $link = connect($host, $dbname);
  6. if($link) {
  7. // setup the queries
  8. $select = "select num, unix_timestamp(date) as date from counter";
  9. $update = "update counter set num = num +1";
  10. // get the current values
  11. $result = query($link, $select);
  12. $data = fetch_object($result,0);
  13. $num = $data->num;
  14. $date = date("F jS, Y",$data->date);
  15. // increment the counter
  16. $return = query($link, $update);
  17. // close up the database connection
  18. close($link);
  19. }
  20. $string = "You are visitor number $num since $date";
  21. $font = 3;
  22. // calculate image size
  23. $width = imagefontwidth($font) * strlen($string);
  24. $height = imagefontheight($font);
  25. $img = imagecreate($width,$height);
  26. $black = imagecolorallocate($img, 0x00,0x00,0x00);
  27. $white = imagecolorallocate($img, 0xFF,0xFF,0xFF);
  28. imagecolortransparent($img,$white);
  29. imagefill($img,0,0,$white);
  30. imagestring($img,$font,0,0,$string,$black);
  31. // output the image
  32. header("Content-type: image/gif");
  33. imagegif($img);
  34. ?>