PHP实例:用SESSION方法实现验证码
index.php(实现输入验证码页面)代码如下: Code代码如下: <html>
<head>
<title>check code</title>
</head>
<body>
<form name=check method=post action=check.php>
<input type=hidden name=init value=1>
验证码:<input type=text name=code maxlength=4 style="width=50px;">
<!--得到验证码图片-->
<img src=image.php>
<p>
<input type=submit value="提交">
</form>
</body>
</html> image.php(验证码生成页面)代码如下: Code代码如下: <?php
session_start();
srand((double)microtime()*1000000);
$authnum=rand(1000,9999);
session_register("authnum");
header("content-type:image/png");
function creat_image( $width, $height, $authnum)
{
srand((double)microtime()*1000000);
$im = imagecreate( $width, $height);
$black = ImageColorAllocate( $im, 0,0,0);
$white = ImageColorAllocate( $im, 255,255,255);
$gray = ImageColorAllocate( $im, 200,200,200);
imagefill( $im,0,0, $gray);
//将四位整数验证码绘入图片
imag
相关文档:
一次Nginx+PHP+Mysql的并发测试经历
一、硬件环境
CPU:4核Intel(R) Xeon(R) CPU E5504 @ 2.00GHz
6G内存,120G硬盘
二、软件环境
L ......
公司MM时常给我一些号码,然我查询是哪家的,都是txt文本格式的,还好号码是一行一个,于是用file()函数取个数组,开始的时候我的win7 32位的可以用apache后来装64位win7由于没找到原生的64位apache于是就传到服务器上每次,有上传有该文件很麻烦,于是做成一个页面去让MM自己完成.废话不多说 要在form表单里上传文件就得需要在表 ......
之前的程序中,在服务器 error_log 中一直有这么一个错误提示:
[19-Nov-2009 22:44:50] PHP Fatal error: Cannot break/continue 1 level in /home/filename.php on line 160
但程序还是可以继续执行下去。
经查阅资料,有这么一说法:
当不在 LOOP 或 SELECT 逻辑条件中时,请不要用 break/continue 来中 ......
这篇文章的出发点是我对插件机制的理解,及其在PHP中的实现。此方案仅是插件机制在PHP中的实现方案之一,写下来和大家分享,欢迎大家一起讨论。
插件,亦即Plug-in,是指一类特定的功能模块(通常由第三方开发者实现),它的特点是:当你需要它的时候激活它,不需要它的时候禁用/删除它;且无论是激活还是禁用都不影 ......
//
dirname()
// Returns directory name component of path
basename()
// Returns filename component of path
pathinfo()
// Returns information about a file path;
// pathinfo() returns an associative array containing information about path .
parse_url()
// Parse a URL and return its comp ......