php将数据库中的电话号码读取出来并生成图片
2015-01-24信息快讯网
<?php //前面不要有空行
$id=$_GET[id];
include("admin/config.php");
$sql="select * from user where id=$id";
$data=mysql_fetch_array(mysql_query($sql));
$p=SBC_DBC($data[Phone],1);
function get_str($str,$strlen=16) {
$str=stripslashes($str);
for($i=0;$i<$strlen;$i++)
if(ord(substr($str,$i,1))>0xa0) $j++;
if($j%2!=0) $strlen++;
$tmp_str=substr($str,0,$strlen);
return $tmp_str;
}
if($p<>''){
//生成5位的数字图片
Header("Content-type:image/png"); //告诉浏览器,下面的数据是图片,而不要按文字显示
//定义图片宽高
$nwidth=120;
$nheight=25;
$im=@imagecreate($nwidth,$nheight) or die("Can't initialize new GD image stream"); //建立图象
//图片色彩设置
$background_color=imagecolorallocate($im,255,255,255); //匹配颜色
$text_color=imagecolorallocate($im,23,14,91);
//绘制图片边框
imagefilledrectangle($im,0,0,$nwidth-1,$nheight-1,$background); //矩形区域着色
imagerectangle($im,0,0,$nwidth-1,$nheight-1,$background_color); //绘制矩形
//srand((double)microtime()*1000000); //取得目前时间的百万分之一秒值,以执行时的百万分之一秒当乱数种子
//$randval=rand();
$randval=$p; //5位数
imagestring($im,8,10,2,$randval,$text_color); //绘制横式字串
//加入干扰因素
//for($i=0;$i<478;$i++)
//{
//$randcolor=imagecolorallocate($im,rand(0,255),rand(0,255),rand(0,255));
//imagesetpixel($im,rand()%100,rand()%30,$randcolor); //点
//}
//imagestring($im,3,5,5,"A Simple Text String",$text_color);
//imageinterlace($im,1);
imagepng($im); //建立png图型
imagedestroy($im); //结束图型
}else{
echo "<font size=2>商家未输入电话号码</font>";
}
?>
php 网页播放器用来播放在线视频的代码(自动判断并选择视频文件类型)
php ftp文件上传函数(基础版)
php下连接ftp实现文件的上传、下载、删除文件实例代码
PHP stristr() 函数(不区分大小写的字符串查找)
php strstr查找字符串中是否包含某些字符的查找函数
php下将图片以二进制存入mysql数据库中并显示的实现代码
php imagecreatetruecolor 创建高清和透明图片代码小结
php gd2 上传图片/文字水印/图片水印/等比例缩略图/实现代码
php getimagesize 上传图片的长度和宽度检测代码
php 图片加水印与上传图片加水印php类
PHP通用分页类page.php[仿google分页]
PHP生成HTML静态页面实例代码
php array_slice函数的使用以及参数详解
PHP中常用数组处理方法实例分析
php判断字符以及字符串的包含方法属性
超级全面的PHP面试题整理集合第1/2页
PHP中用header图片地址 简单隐藏图片源地址
用来给图片加水印的PHP类
用php获取远程图片并把它保存到本地的代码
简单的PHP图片上传程序
php图片验证码代码