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
相关文档:
/*
* 功能:PHP
图片水印 (水印支持图片或文字)
* 参数:
* $product_img 背景图片,即需要加水印的图片,暂只支持GIF,JPG,PNG格式;
* $waterPos 水印位置,有10种状态,0为随机位置;
* &n ......
一次Nginx+PHP+Mysql的并发测试经历
一、硬件环境
CPU:4核Intel(R) Xeon(R) CPU E5504 @ 2.00GHz
6G内存,120G硬盘
二、软件环境
L ......
PHP是个伟大的web开发语言,灵活的语言,但是看到php程序员周而复始的犯的一些错误。我做了下面这个列表,列出了PHP程序员经常犯的10中错误,大多数和安全相关。看看你犯了几种
1.不转意html entities
一个基本的常识:所有不可信任的输入(特别是用户从form中提交的数据) ,输出之前都要转意。
echo $_GE ......
公司MM时常给我一些号码,然我查询是哪家的,都是txt文本格式的,还好号码是一行一个,于是用file()函数取个数组,开始的时候我的win7 32位的可以用apache后来装64位win7由于没找到原生的64位apache于是就传到服务器上每次,有上传有该文件很麻烦,于是做成一个页面去让MM自己完成.废话不多说 要在form表单里上传文件就得需要在表 ......
#找到:
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gz ......