易截截图软件、单文件、免安装、纯绿色、仅160KB

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处理在线用户

 转贴自: http://hi.baidu.com/isnono/blog/item/3c94ea11a54a0fc7a7ef3f94.html
经常在CSDN的PHP论坛上看到有朋友问处理在线用户的问题,我写过类似的代码,就拿出来献丑了,有点垃圾,基本上实现了功能, 同是也能够扩展,比如同时只允许一个帐号在线等。
/*
程序用途:检测在线用户
程序作者:heiyeluren
写作时间 ......

php array_diff()

 array array_diff
( array array1, array array2 [, array
...] )
array_diff()
返回一个数组,该数组包括了所有在 array1
中但是不在任何其它参数数组中的值。注意键名保留不变。
猛的一看这个方法,还以为是将两个数组中不同的返回来呢,事实上不是,返回的是在array1中的,但是不在其他数组中的。 ......

PHP 5.2.11安装

#找到:
    # 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 ......

PHP教程:插件机制在PHP中实现方案

 这篇文章的出发点是我对插件机制的理解,及其在PHP中的实现。此方案仅是插件机制在PHP中的实现方案之一,写下来和大家分享,欢迎大家一起讨论。
插件,亦即Plug-in,是指一类特定的功能模块(通常由第三方开发者实现),它的特点是:当你需要它的时候激活它,不需要它的时候禁用/删除它;且无论是激活还是禁用都不影 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号