完整的PHP图形验证码程序源码!
代码如下:
<?php
/* 网站验证码程序
* 运行环境: PHP5.0.18 下调试通过
* 需要 gd2 图形库支持(PHP.INI中 php_gd2.dll开启)
* 文件名: showimg.php
* 作者: 17php.com
* Date: 2007.03
* 技术支持: www.17php.com
*/
//随机生成一个4位数的数字验证码
$num="";
for($i=0;$i<4;$i++){
$num .= rand(0,9);
}
//4位验证码也可以用rand(1000,9999)直接生成
//将生成的验证码写入session,备验证页面使用
Session_start();
$_SESSION["Checknum"] = $num;
//创建图片,定义颜色值
Header("Content-type: image/PNG");
srand((double)microtime()*1000000);
$im = imagecreate(60,20);
$black = ImageColorAllocate($im, 0,0,0);
$gray = ImageColorAllocate($im, 200,200,200);
imagefill($im,0,0,$gray);
//随机绘制两条虚线,起干扰作用
$style = array($black, $black, $black, $black, $black, $gray, $gray, $gray, $gray, $gray);
imagesetstyle($im, $style);
$y1=rand(0,20);
$y2=rand(0,20);
$y3=rand(0,20);
$y4=rand(0,20);
imageline($im,
相关文档:
1.Appserv 是什么?
Appserv 是PHP网页架站工具组合包,可以将网络上免费的架站资源重新包装成单一的安装程序。它提供了简易、快速的PHP运行环境的搭建机制,读者只需按照普通应用软件的安装方式就可以完成Apache+MySQL+PHP+phpMyAdmin的安装与配置工作。
2.Appserv 下载地址
http://www. ......
how to install apache, PHP and MySQL on Linux
This tutorial explains the installation of Apache web server, bundled with PHP and MySQL server on a Linux machine. The tutorial is primarily for SuSE 9.2, 9.3, 10.0 & 10.1 operating systems, but most of the steps ought to be valid for all Linux-lik ......
how to install apache, PHP and MySQL on Linux
This tutorial explains the installation of Apache web server, bundled
with PHP and MySQL server on a Linux machine. The tutorial is primarily for SuSE
9.2, 9.3, 10.0 & 10.1, but most of the steps ought to be valid for all
Linux-like operating ......
本文转自http://xfs39.javaeye.com/blog/411508 感谢作者分享
php单引号和双引号的区别
今天,有一新学PHP的网友问了茶农一个问题:“单引号和双引号的区别和用法?”,现将答案总结了下,写成这篇小短文。
" "双引号里面的字段会经过编译器 ......
$file1 = 'F:/46.gif';
$file2 = 'F:/test.txt';
$file3 = 'F:/47.gif';
$size = filesize($file1);
echo '文件大小为:'.$size;
echo "\n<br>转化为二进制 ...";
$content = file_get_contents($file1);
$content = bstr2bin($content);
$fp = fopen($file2, 'w');
fwrite($fp, $content);
fclose($fp);
......