完整的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,
相关文档:
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 ......
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 ......
问题一:cacti如法正常登录,没有报PHP程序错误
解决过程解决过程:开启PHP报错显示(在调试时,一直卡在这儿,由于是服务器上,没有开启报错程序)display_errors = On
发现报Warning: session_start() [ ......
www.diybl.com 时间:2008-06-01 作者:佚名
将其保存成一个文件,用时调用
<?
//为了避免重复包含文件而造成错误,加了判断函数是否存在的条件:
if(!function_exists(pageft)){
//定义函数pageft(),三个参数的含义为:
//$totle:信息总数;
//$displaypg:每页显示信息数,这里设置为默认是20;
//$url:分 ......
EClipse for PHP 中文乱码问题
UTF-8 格式的php,中文都是乱码.
如果此时在EClipse中输入中文会有 CP1252 错误( CP1252不支持xxxx )
解决方法:
windows->preferences->general 打开点击workspace 此时右侧出现text file encoding就是文本编码 default cp1252 点击other 下拉菜单 选择UTF-8 选择即可编译 ......