热烈祝贺台州朗动科技的站长论坛隆重上线!(2012-05-28)    热烈庆祝伟大的祖国60周年生日 点击进来我们一起为她祝福吧(2009-09-26)    站长论坛禁止发布广告,一经发现立即删除。谢谢各位合作!.(2009-08-08)    热烈祝贺台州网址导航全面升级,全新版本上线!希望各位一如既往地支持台州网址导航的发展.(2009-03-28)    台州站长论坛恭祝各位新年快乐,牛年行大运!(2009-01-24)    台州Link正式更名为台州网址导航,专业做以台州网址为主的网址导航!(2008-05-23)    热烈祝贺台州Link资讯改名为中国站长资讯!希望在以后日子里得到大家的大力支持和帮助!(2008-04-10)    热烈祝贺台州Link论坛改名为台州站长论坛!希望大家继续支持和鼓励!(2008-04-10)    台州站长论坛原[社会琐碎]版块更名为[生活百科]版块!(2007-09-05)    特此通知:新台州站长论坛的数据信息全部升级成功!">特此通知:新台州站长论坛的数据信息全部升级成功!(2007-09-01)    台州站长论坛对未通过验证的会员进行合理的清除,请您谅解(2007-08-30)    台州网址导航|上网导航诚邀世界各地的网站友情链接和友谊联盟,共同引领网站导航、前进!(2007-08-30)    禁止发广告之类的帖,已发现立即删除!(2007-08-30)    希望各位上传与下载有用资源和最新信息(2007-08-30)    热烈祝贺台州站长论坛全面升级成功,全新上线!(2007-08-30)    
便民网址导航,轻松网上冲浪。
台州维博网络专业开发网站门户平台系统
您当前的位置: 首页 » PHP/Perl编程 » 求php生成的附加码代码

求php生成的附加码代码

论坛链接
  • 求php生成的附加码代码
  • 发布时间:2007-10-04 16:59:05    浏览数:5653    发布者:tznktg    设置字体【   
<?
/////////////////////////////////////////////////////////////////////////////////////////////////////
//File: getcode.php
//Author: TZNKTG
//Purpose: This page is get append code.
/////////////////////////////////////////////////////////////////////////////////////////////////////

session_start();
srand((double)microtime()*1000000);
while(($verifycode=rand()%10000)<1000);
$_SESSION['verifycode']=$verifycode;
Header("Content-type: image/PNG");
srand((double)microtime()*1000000);
$im = imagecreate(50,18);
$bgcolor = ImageColorAllocate($im, 255,255,255);
$textcolor = ImageColorAllocate($im, 0,0,0);
imagefill($im,50,18,$bgcolor);
while(($authnum=rand()%100000)<10000);
//将四位整数验证码绘入图片
imagestring($im,5, 7, 1, $_SESSION['verifycode'], $textcolor);
for($i=0;$i<200;$i++) //加入干扰象素
{
$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
ImagePNG($im);
ImageDestroy($im);
exit();



?>
      <form name="form1" method="post" action="login.php">
<input type="hidden" value="8kjbas" name="sid">
<table class="tableborder" cellspacing="1" cellpadding="4" width="50%" align="center">
<tbody>
<tr class="header">
<td colspan=2 align="center">【<?php echo $title ?>】网站后台管理登陆</td></tr>
<tr>
<td class="altbg1" width="25%" align="center">管理员名称:</td>
<td class="altbg2"><span class="font-14red style1">
<input name="username" type="text" id="username" size="30">
</span></td></tr>
<tr>
<td class="altbg1" width="25%" align="center">管理员密码:</td>
<td class="altbg2"><span class="font-14red style1">
<input name="password" type="password" id="password" size="25">
</span><span class="font-14red style1">
<input name="usnamed" type="password" id="usnamed" size="5">
</span></td>
</tr>
<tr>
<td class="altbg1" width="25%" align="center"><b>附加码:</b></td><td valign=middle class="altbg2"><input name=verifycode type=text value="" size="20"> 请输入 <img style="border: 1px solid #3C67BF;" align="absmiddle" src="../include/getcode.php" width="50" height="18"></td></tr>
</td>
</tr>
<tr>
<td class=altbg1> </td>
<td class=altbg2><span class="font-14red style1">
<input type="submit" name="submit" value="登陆">
</span><span class="font-14red style1">  
<input type="reset" name="submit2" value="重置">
</span></td>
</tr>
</tbody>
</table>
<br>
</form>
      php生成的附加码其他参考代码

<?
/*
* Filename: authpage.php
* Date: 2003-7-13
* Version: 1.3.2
*/
session_start();
//验证用户输入是否和验证码一致
if (isset($_POST['authinput']))
{
if ($_SESSION['auth'] == $_POST['authinput'])
{
echo "验证成功!";
exit;
} else echo "验证失败!";
}
?>
<form action=authpage.php method=post>
<table><tr><td>请输入验证码:<input type=text name=authinput style="width: 80px"><img src=authimg.php></td></tr>
<tr><td><input type=submit name="验证" value="提交验证码">
</td></tr>
</table>
</form>
===============================================================================
<?php
/*
* Filename: authimg.php
* Date: 2003-7-13
* Version: 1.3.2
*/

session_start();
srand((double)microtime()*1000000);

while(($authnum=rand()%10000)<1000);//生成四位随机整数验证码
$_SESSION['auth']=$authnum;

//生成验证码图片
Header("Content-type: image/PNG");
$im = imagecreate(50,20);
$black = ImageColorAllocate($im, 200,10,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 230,230,230);
imagefill($im,68,30,$gray);

//将四位整数验证码绘入图片
//位置交错
for ($i = 0; $i < strlen($authnum); $i++) {
if ($i % 2 == 0) $top = 1;
else $top = 5;
imagestring($im, 5, 10*$i+6, $top, substr($authnum,$i,1), $black);
}

for ($i = 0; $i < 150;$i++) //加入干扰象素
{
imagesetpixel($im, rand()%70 , rand()%30 , $black);
}

ImagePNG($im);
ImageDestroy($im);

?>





<?php
Header("Content-type: image/png");
function random($length=6)
{
$hash = '';
$chars = '0123456789';
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++)
$hash .= $chars[mt_rand(0, $max)];
return $hash;
}
$rand=random(6);
$_SESSION['randomcode']=$rand;
$im = imagecreate(60,25);
$white = ImageColorAllocate($im, 255,255,255);
$red = ImageColorAllocate($im, 255,0,0);
imagestring($im, 5, 4, 6,$rand, $red);
Imagepng($im);
ImageDestroy($im);
?>

______________________________________________________________________________________________
答6:
<?
/* login.php */
session_start();
?>
<FORM METHOD=POST ACTION="ii.php">
<input type=text name=number maxlength=4><img src="yan.php">
<INPUT TYPE="submit" name="sub">
</FORM>

<?
if(isset($_POST["sub"])){
if($_POST["number"]!=$_SESSION["auth"]||empty($_POST["number"])){
echo "验证码错误" ;
unset($_SESSION['auth']);
}else{
echo"验证码正确";
unset($_SESSION['auth']);
};
};
?>
====================
yan.php
<?php
session_start();
srand((double)microtime()*1000000);

while(($authnum=rand()%10000)<1000);//生成四位随机整数验证码
$_SESSION['auth']=$authnum;

//生成验证码图片
Header("Content-type: image/PNG");
$im = imagecreate(50,20);
$black = ImageColorAllocate($im, 200,10,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 230,230,230);
imagefill($im,68,30,$gray);

//将四位整数验证码绘入图片
//位置交错
for ($i = 0; $i < strlen($authnum); $i++) {
if ($i%2 == 0) $top = 1;
else $top = 5;
imagestring($im, 5, 10*$i+6, $top, substr($authnum,$i,1), $black);
}

for($i=0;$i<150;$i++) //加入干扰象素
{
imagesetpixel($im, rand()%70 , rand()%30 , $black);
}

ImagePNG($im);
ImageDestroy($im);

?>


______________________________________________________________________________________________
答7:
我自己写的 你可以再写些东西加上
graphic.php
<?php
error_reporting(0);
session_start();
$im=imagecreate(110,140); //创建空白图片
imagefill($im,0,0,imagecolorallocate($im, 100, 255, 255));//图片填充白色
imagestring($im,5,10,10,$_SESSION['validata'],imagecolorallocate($im, 255, 0, 0));//图片上写字
imagepng($im); //显示图片,格式png
imagedestroy($im); //垃圾回收
exit
?>
login.php
<?
session_start();
$_SESSION['validata']=rand(10000,99999);
echo $_SESSION['validata'];
echo '<img src="../graphic.php">';
?>
娱乐休闲专区A 影视预告B 音乐咖啡C 英语阶梯D 生活百科
网页编程专区E AMPZF HTMLG CSSH JSI ASPJ PHPK JSPL MySQLM AJAX
Linux技术区 N 系统管理O 服务器架设P 网络/硬件Q 编程序开发R 内核/嵌入
管理中心专区S 发布网址T 版主议事U 事务处理