<?php
//包含一个计数器,一个提醒语句,用户ip以及自己的广告图片。
//给浏览器发送头,说我是张图片
Header("Content-type: image/PNG");
//这里定义计数器,放到一个文件里的
$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];
}
//计数器结束
//开始创建图片定义颜色字体等
$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和主机名,当然是用户端的
$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";
}
//开始创建图像背景边框
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);
//有个运动效果就用笔刷来刷了,相当于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);
//图片结尾必然语句
ImagePNG($im);
ImageDestroy($im);
?>
//包含一个计数器,一个提醒语句,用户ip以及自己的广告图片。
//给浏览器发送头,说我是张图片
Header("Content-type: image/PNG");
//这里定义计数器,放到一个文件里的
$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];
}
//计数器结束
//开始创建图片定义颜色字体等
$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和主机名,当然是用户端的
$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";
}
//开始创建图像背景边框
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);
//有个运动效果就用笔刷来刷了,相当于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);
//图片结尾必然语句
ImagePNG($im);
ImageDestroy($im);
?>
标签:
PHP中动态显示签名和ip原理
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“PHP中动态显示签名和ip原理”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。