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.
|
|
<?php
// import the database configuration
require("db.php3");
// get values from database
$link = connect($host, $dbname); if($link) { // setup the queries
$select = "select num, unix_timestamp(date) as date from counter"; $update = "update counter set num = num +1"; // get the current values
$result = query($link, $select); $data = fetch_object($result,0); $num = $data->num; $date = date("F jS, Y",$data->date); // increment the counter
$return = query($link, $update); // close up the database connection
close($link); }
$string = "You are visitor number $num since $date"; $font = 3;
// calculate image size
$width = imagefontwidth($font) * strlen($string); $height = imagefontheight($font);
$img = imagecreate($width,$height);
$black = imagecolorallocate($img, 0x00,0x00,0x00); $white = imagecolorallocate($img, 0xFF,0xFF,0xFF);
imagecolortransparent($img,$white); imagefill($img,0,0,$white); imagestring($img,$font,0,0,$string,$black);
// output the image
header("Content-type: image/gif"); imagegif($img);
?>
|