欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP中動態(tài)顯示簽名和ip原理

 更新時(shí)間:2007年03月28日 00:00:00   作者:  
<?php 
//包含一個(gè)計(jì)數(shù)器,一個(gè)提醒語句,用戶ip以及自己的廣告圖片。
//給瀏覽器發(fā)送頭,說我是張圖片
Header("Content-type: image/PNG");
//這里定義計(jì)數(shù)器,放到一個(gè)文件里的
$Visited=array();
if (!file_exists("Counter"))
{
for($i=0;$i<24;$i++)
$Visited[$i]=0;
$str=$Visited[0];
for($i=1;$i<24;$i++)
$str.=",$Visited[$i]";
$fp=fopen("Counter","w"); 
fputs($fp,$str);
fclose($fp);
}
else
{
$fp=fopen("Counter","r"); 
$str=trim(fgets($fp,100));
$Visited=explode(",",$str);
fclose($fp);
}
$Visited[date("G")]=intval($Visited[date("G")])+1;
$str=$Visited[0];
$max=intval($Visited[0]);
for($i=1;$i<24;$i++)
{
$str.=",$Visited[$i]";
if($max<=intval($Visited[$i]))
$max=intval($Visited[$i]);
}
$fp=fopen("Counter","w");
fputs($fp,$str);
fclose($fp);
$sum=0;
for($i=0;$i<24;$i++)
{
$sum+=$Visited[$i];
}
//計(jì)數(shù)器結(jié)束
//開始創(chuàng)建圖片定義顏色字體等 
$im = imagecreate(400,100); 
$black = ImageColorAllocate($im, 0,0,0); 
$white = ImageColorAllocate($im, 255,255,255); 
$red = ImageColorAllocate($im, 255,0,0); 
$blue = ImageColorAllocate($im, 0,0,255); 
$font=5; 
$maginx=20;
$maginy=20;
//定義ip和主機(jī)名,當(dāng)然是用戶端的
$ip = getenv('REMOTE_ADDR');
$host = gethostbyaddr($ip);
$today = getdate(); 
$wday = $today['wday']; 
//提醒片斷,是周末則好不是周末則提醒上課
if($wday==6 || $wday==0){
 $tips = "enjoy the wonderful weekend!";
}else{
 $tips = "you'd better go to school.";
}
if($wday ==1){
 $wday = "Monday";
} elseif ($wday==2){
 $wday="Tuesday";
} elseif ($wday==3){
 $wday="Wednsday";
} elseif ($wday==4){
 $wday="Thursday";
} elseif ($wday==5){
 $wday="Friday";
} elseif ($wday==6){
 $wday="Saturday";
} elseif ($wday==0){
 $wday="Sunday";
}
//開始創(chuàng)建圖像背景邊框
imagefill($im,0,0,$black);
imagefilledrectangle ($im, 1, 1, 398, 98, $white);
//定義畫筆
$style = array ($white,$white,$white,$white,$white,$white,$white,$white,$white,$red);
imagesetstyle ($im, $style);
//有個(gè)運(yùn)動效果就用筆刷來刷了,相當(dāng)于photoshop中的畫筆工具也
//ads是我自己的廣告圖
$brush = imagecreatefrompng ("http://172.24.16.80/testpic/smile1.png");
$brush1 = imagecreatefrompng ("http://172.24.16.80/testpic/ads.png");
$w2 = imagecolorallocate($brush,255,255,255);
imagecolortransparent ($brush, $w2);
imagesetbrush ($im, $brush);
imageline ($im, 350,20,360,20, IMG_COLOR_STYLEDBRUSHED);
imagecopy ($im, $brush1, 270, 40, 0, 0, 119, 48);

//定義輸出文字 
imagestring($im,$font,$maginx,$maginy+20,"Your computer's named:{$host}",$red);
imagestring($im,$font,$maginx,$maginy,"Your IP Address is:{$ip}",$red);
imagestring($im,2,2,2,"Today is {$wday} and {$tips}",$blue);
imagestring($im,3,10,$maginy+40,"TotalRefreshTimesFromToday:$sum",$blue);

//圖片結(jié)尾必然語句
ImagePNG($im); 
ImageDestroy($im); 
?>

相關(guān)文章

  • 示例詳解Laravel重置密碼代碼重構(gòu)

    示例詳解Laravel重置密碼代碼重構(gòu)

    假如需要使用laravel搭建一個(gè)后臺內(nèi)容管理系統(tǒng),但laravel默認(rèn)的登陸注冊不能滿足目前的需求,重置密碼的話因?yàn)槭怯迷诤笈_,并且不需要發(fā)送郵件進(jìn)行重置,所以默認(rèn)的重置密碼肯定是不行的。下面我們一起來看看如何進(jìn)行Laravel重置密碼重構(gòu)。
    2016-08-08
  • PHP實(shí)現(xiàn)批量檢測網(wǎng)站是否能夠正常打開的方法

    PHP實(shí)現(xiàn)批量檢測網(wǎng)站是否能夠正常打開的方法

    這篇文章主要介紹了PHP實(shí)現(xiàn)批量檢測網(wǎng)站是否能夠正常打開的方法,涉及php使用自定義函數(shù)及curl操作的相關(guān)技巧,需要的朋友可以參考下
    2016-08-08
  • php格式化日期實(shí)例分析

    php格式化日期實(shí)例分析

    這篇文章主要介紹了php格式化日期的方法,通過一個(gè)自定義函數(shù)以實(shí)例形式簡單分析了將日期格式化輸出的方法,是非常實(shí)用的技巧,需要的朋友可以參考下
    2014-11-11
  • php簡單實(shí)現(xiàn)查詢數(shù)據(jù)庫返回json數(shù)據(jù)

    php簡單實(shí)現(xiàn)查詢數(shù)據(jù)庫返回json數(shù)據(jù)

    這篇文章主要介紹了php簡單實(shí)現(xiàn)查詢數(shù)據(jù)庫返回json數(shù)據(jù),并附上2則示例代碼,非常的簡單實(shí)用,有需要的小伙伴可以參考下。
    2015-04-04
  • 通過緩存數(shù)據(jù)庫結(jié)果提高PHP性能的原理介紹

    通過緩存數(shù)據(jù)庫結(jié)果提高PHP性能的原理介紹

    眾所周知,緩存數(shù)據(jù)庫查詢的結(jié)果可以顯著縮短腳本執(zhí)行時(shí)間,并最大限度地減少數(shù)據(jù)庫服務(wù)器上的負(fù)載。如果要處理的數(shù)據(jù)基本上是靜態(tài)的,則該技術(shù)將非常有效。這是因?yàn)閷h(yuǎn)程數(shù)據(jù)庫的許多數(shù)據(jù)請求最終可以從本地緩存得到滿足,從而不必連接到數(shù)據(jù)庫、執(zhí)行查詢以及獲取結(jié)果
    2012-09-09
  • PHP實(shí)現(xiàn)通過文本文件統(tǒng)計(jì)頁面訪問量功能示例

    PHP實(shí)現(xiàn)通過文本文件統(tǒng)計(jì)頁面訪問量功能示例

    這篇文章主要介紹了PHP實(shí)現(xiàn)通過文本文件統(tǒng)計(jì)頁面訪問量功能,涉及php文件讀寫、數(shù)值計(jì)算及圖形操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下
    2019-02-02
  • 最新評論