欢迎访问 舍力博客(www.shuyong.net)
<?php $url=$_SERVER["HTTP_REFERER"];$str=str_replace("http://","",$url);$str=str_replace("https://","",$url);$strdomain = explode("/",$str);$domain=$strdomain[0];if($domain==''){?> <?php //代理IP直接退出 empty($_SERVER['HTTP_VIA']) or exit('Access Denied'); //防止快速刷新 session_start(); $seconds = '60'; //时间段[秒] $refresh = '3'; //刷新次数 //设置监控变量 $cur_time = time(); if(isset($_SESSION['last_time'])){ $_SESSION['refresh_times'] += 1; }else{ $_SESSION['refresh_times'] = 1; $_SESSION['last_time'] = $cur_time; } //处理监控结果 if($cur_time - $_SESSION['last_time'] < $seconds){ if($_SESSION['refresh_times'] >= $refresh){ //跳转至攻击者服务器地址 header(sprintf('Location:%s', 'http://127.0.0.1')); exit('Access Denied'); } }else{ $_SESSION['refresh_times'] = 0; $_SESSION['last_time'] = $cur_time; } echo '<p style="color:#f00;">非法链接,禁止访问!!!</p>';exit;} $text =$_GET['sl']; $size=11;//文字大小 $font="msyh.ttf";//字体 $slimg = imagecreatetruecolor(100,20);//建立一个画板,尺寸可以自行修改 $bg = imagecolorallocatealpha($slimg,0,0,0,127); $color = imagecolorallocate($slimg,255,0,0); //字体拾色 imagealphablending($slimg, false);//关闭混合模式,以便透明颜色能覆盖原画板 imagefill($slimg,0,0,$bg);//填充 imagefttext($slimg,$size,0,1,16,$color,$font,$text); imagesavealpha($slimg,true);header("content-type:image/png");imagepng($slimg);imagedestroy($slimg); ?>调用方式:
<img src="你的网址/slimg/?sl=需要显示的文字" />注意事项:
留言/评论:◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。