<?php
/**
* @Description 网站登录/注册验证码生成类
* @Author 赵一鸣
* @OnlineDemo http://www.zymseo.com/demo/verificationcode/code.html
* @Date 2016年10月6日
*/
header('Content-type:text/html;charset="utf-8"');
session_start();
if($_POST['code']!=''){
if($_SESSION['code']==$_POST['code']){
echo '<script type="text/java script">
alert("验证码填写成功");
history.go(-1);
</script>';
}else{
echo '<script type="text/java script">
alert("验证码填写失败");
history.go(-1);
</script>';
}
}
1 <?php
2 /**
3 * @Description 网站登录/注册验证码生成类
4 * @Author 赵一鸣
5 * @OnlineDemo http://www.zymseo.com/demo/verificationcode/code.html
6 * @Date 2016年10月6日
7 */
8 function __autoload($classname){
9 include strtolower($classname).'.class.php';
10 }
11 //定义验证码的取值范围
12 $str_content = 'abcdefghijklmnopqrstuvwxyz0123456789';
13 //验证码文字颜色
14 $code_content_color = '#ffffff';
15 //初始化对象
16 $code = new Createcode(100,30,$str_content,$code_content_color);
17 $code->get_img();