:::

15-4 counter.php

<?php
$root_pass="12345";    //資料庫root密碼
$db_name="test";  //資料庫名稱

/* 連資料庫檢查 */
$link=mysql_connect("localhost","root",$root_pass);  //資料庫連線
mysql_select_db("test");
mysql_query("SET NAMES 'utf8'");  //設定語系
error_reporting(0);

$today=date("Y-m-d");
if($_GET['op']=="all"){
    $sql="select sum(`counter`) from `counter`";
    $bg="bnr_40.gif";
    $size=18;
    $x=20;
    $y=26;
}else{
    $sql="select `counter` from `counter` where `day`='$today'";
    $bg="bnr_35.gif";
    $size=12;
    $x=10;
    $y=18;
}
$result=mysql_query($sql);
list($counter)=mysql_fetch_row($result);
$counter=sprintf("%07s",$counter);

header("Content-type: image/gif");
$im = @imagecreatefromgif($bg) or die("無法建立GD圖片");
$text_color = imagecolorallocate($im, 0, 0, 0);
imagettftext($im, $size, 0 , $x, $y, $text_color,"D3Petitbitmapism.ttf",$counter);

imagegif($im);
imagedestroy($im);
?>


:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D8%26tbdsn%3D222

書籍目錄

展開 | 闔起

線上使用者

27人線上 (5人在瀏覽線上書籍)

會員: 0

訪客: 27

更多…