0

0

上到到空间后验证码不显示?

php中文网

php中文网

发布时间:2016-06-23 14:18:43

|

1319人浏览过

|

来源于php中文网

原创

我在自己的电脑上运行验证码是显示的,怎么我上传到网上空间就不显示啦,是什么原因啊?


回复讨论(解决方案)

你的验证码是用什么方式写的?
看下空间上是否有开启这个功能
如果有,看下有没权限创建这个验证码

注释掉声明数据类型的 header 函数,用浏览器直接运行生成程序

<?php    //随机字符串种子,可以换成字母或其他英文字符    $glbVerifySeed = "AbcDefGhijkL1234567890mnOpqRstuvwxYz";    main();            function main() {        session_start();                $verifyCode = getRandomCode();        $_SESSION["verifyCode"] = $verifyCode;        $imgWidth = $_REQUEST["width"];        $imgHeight = $_REQUEST["height"];        $imgFont = $_REQUEST["font"];                if($imgWidth == "") $imgWidth = 50;        if($imgHeight == "") $imgHeight = 20;        if($imgFont == "") $imgFont = 6;        doOutputImg($verifyCode, $imgWidth, $imgHeight, $imgFont);    }        //获取随机数字字符串    function getRandomCode($length=4) {        global $glbVerifySeed;                $bgnIdx = 0;        $endIdx = strlen($glbVerifySeed)-1;                $code = "";        for($i=0; $i<$length; $i++) {            $curPos = rand($bgnIdx, $endIdx);            $code .= substr($glbVerifySeed, $curPos, 1);        }                return $code;    }        //输出校验码图像    function doOutputImg($string, $imgWidth, $imgHeight, $imgFont,        $imgFgColorArr=array(0,0,0), $imgBgColorArr=array(255,255,255)) {        $image = imagecreatetruecolor($imgWidth, $imgHeight);        //用白色背景加黑色边框画个方框        $backColor = imagecolorallocate($image, 255, 255, 255);        $borderColor = imagecolorallocate($image, 255, 255, 255);        imagefilledrectangle($image, 0, 0, $imgWidth - 1, $imgHeight - 1, $backColor);        imagerectangle($image, 0, 0, $imgWidth - 1, $imgHeight - 1, $borderColor);        $imgFgColor = imagecolorallocate ($image, $imgFgColorArr[0], $imgFgColorArr[1], $imgFgColorArr[2]);        doDrawStr($image, $string, $imgFgColor, $imgFont);        doPollute($image, 64);        header('Content-type: image/png');        imagepng($image);        imagedestroy($image);    }    //画出校验码    function doDrawStr($image, $string, $color, $imgFont) {        $imgWidth = imagesx($image);        $imgHeight = imagesy($image);                $count = strlen($string);        $xpace = ($imgWidth/$count);                $x = ($xpace-6)/2;        $y = ($imgHeight/2-8);        for ($p = 0; $p<$count;  $p ++) {            $xoff = rand(-2, +2);            $yoff = rand(-2, +2);            $curChar = substr($string, $p, 1);            imagestring($image, $imgFont, $x+$xoff, $y+$yoff, $curChar, $color);            $x += $xpace;        }        return 0;    }        //画出一些杂点    function doPollute($image, $times) {           $imgWidth = imagesx($image);        $imgHeight = imagesy($image);        for($j=0; $j<$times; $j++) {            $x = rand(0, $imgWidth);            $y = rand(0, $imgHeight);                        $color = imagecolorallocate($image, rand(0,255), rand(0,255), rand(0,255));            imagesetpixel($image, $x, $y, $color);        }    }?>

验证码是这样写的。

<?require_once('lib07/function_form.inc.php');require_once('lib07/config.inc.php');if(!defined('dbzz_net')) {	exit('Access Denied');}?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title><?=$global_websitename;?></title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><link href="css/style.css" rel="stylesheet" type="text/css" /><script language="javascript"><!--function FormCheck() {  if (myform.userid.value=="")  {    alert("请您填写用户ID!");    document.myform.userid.focus();    return false;  }var filter=/^\s*[A-Za-z0-9_-]{4,20}\s*$/;if (!filter.test(document.myform.userid.value)) { alert("用户名填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 下划线 减号)长度不小于4个字符,不超过20个字符,注意不要使用空格。"); document.myform.userid.focus();//document.myform.username.select();return false; }    if (myform.pwd.value=="")  {    alert("请您填写密码!");    document.myform.pwd.focus();    return false;  }  if(myform.check.value==""){	   alert ("验证码必须填写!");	   myform.check.focus();	   return false;}var filter=/^\s*[A-Za-z0-9_-]{4,20}\s*$/;if (!filter.test(document.myform.pwd.value)) { alert("密码填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 下划线 减号)长度不小于4个字符,不超过20个字符,注意不要使用空格。"); document.myform.pwd.focus();document.myform.pwd.select();return false; }        return true;  }//function shutwin(){opener=null;self.close();}////function showme1() {//window.open("","pop","scrollbars=no,status=yes,resizable=yes,top=0,left=0,width="+(screen.availWidth-10)+",height="+(screen.availHeight-30)+",channelmode=no");//shutwin();//}function textLimitCheck(thisArea, maxLength){    if (thisArea.value.length > maxLength)	{      alert(maxLength + ' 个字限制. \r超出的将自动去除.');      thisArea.value = thisArea.value.substring(0, maxLength);      thisArea.focus();    }    /*回写span的值,当前填写文字的数量*/  }function change()  	{  	var img =document.getElementById("codeimg");  	img.src=img.src+"?";  	}  //--></script></head><body style="background:#145597 url(myimages/one/login_back.gif) repeat-x top;" scroll=no><table width="1004" height="618" border="0"  cellpadding="0" cellspacing="0" background="myimages/1/loginback.jpg">  <tr>    <td align="center" ><table width="498" height="222" border="0" cellpadding="0" cellspacing="9" bgcolor="215992">        <tr>          <td background="myimages/1/loginback_mid.jpg" bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">              <tr>                <td height="40"  class="websitename">    金科网络公司OA系统登录</td>              </tr>              <tr>                <td><form name="myform" method="post" onSubmit="return FormCheck();" action="userinfo/login.php">                    <table width="100%" border="0" cellspacing="0" cellpadding="2">                      <tr>                         <td width="25%" height="26" align="right"><font color="#0057AE">账 号:</font></td>                        <td width="38%"><input name="userid" type="text" id="Uname" style="width:148px;padding-bottom:2px;padding-left:3px;line-height:22px;margin:0px auto;" tabindex=1 size="18" maxlength="20"></td>                        <td width="37%" rowspan="3"><input type="image" src="myimages/1/loginbutton.gif" name="Submit" style="height:62px;width:62px;border:0px;" width="62" height="62" tabindex=3 value="-立刻登录-" >                         </td>                      </tr>                      <tr>                         <td height="26" align="right"><font color="#0057AE">密 码:</font></td>                        <td><input name="pwd" type="password" id="Upass" style="width:148px;padding-bottom:2px;line-height:22px;padding-left:3px;margin:0px auto;" tabindex=2 size="20" maxlength="20" ></td>                      </tr>					  <tr>                         <td height="26" align="right"><font color="#0057AE">验证码:</font></td>                        <td><input type="text" name="check" style="width:148px;padding-bottom:2px;padding-left:3px;line-height:22px;margin:0px auto;" tabindex=1 size="18" maxlength="20"></td></tr>						<tr><td> </td><td><img  src="userinfo/Verifycode.php" onClick="this.src='userinfo/Verifycode.php?rand='+Math.random()*5;"   style="max-width:90%" id="codeimg"/ alt="上到到空间后验证码不显示?" > <a href="javascript:change();" style="cursor:pointer;">看不清楚,换一张</a></td>                      </tr>                    </table>                  </form></td>              </tr>              <tr>                <td  style="max-width:90%" style="color:#53a3c6;line-height:22px;">    业务部专用<br>                   </td>              </tr>            </table></td>        </tr>      </table></td>  </tr></table></body></html>

调用是这样调用的

空心菜的米库
空心菜的米库

1,对界面进行了美化2,对文件里边相同代码进行了综合3,增加了点击次数统计,并对3次点击以上的域名增加热门字样4,对本站出售和个人出售进行了划分5,增加钻石状态说明6,增加了完整的后台界面7,增加对资料修改功能8,增加回收站,可以任意删除域名、恢复删除域名和永久删除数据9,还有其他的细节大家自己看~10.增加域名证书显示11.域名到期时间采用日历控件形式12.后台登陆添加了验证码功能13.还有很多

下载

这样写在本地只要把wamp里面的php_gd2选上就行显示啦,怎么上传到空间后就没有显示啦呢?请帮帮我,谢谢!

空间里面 gd开启了嘛?报什么错?

空间里面 gd开启了嘛?报什么错?
空间是买的,怎么开gd啊,没有报错,就是不显示,直接不显示。

Notice:  Undefined index: width in .... on line 11
Notice:  Undefined index: height in ... on line 12
Notice:  Undefined index: font in ... on line 13

而你只有 上到到空间后验证码不显示? 并没有传入参数

Notice:  Undefined index: width in .... on line 11
Notice:  Undefined index: height in ... on line 12
Notice:  Undefined index: font in ... on line 13

而你只有 上到到空间后验证码不显示? 并没有传入参数
那应该怎么写?麻烦你教一下,谢谢!

热门AI工具

更多
DeepSeek
DeepSeek

幻方量化公司旗下的开源大模型平台

豆包大模型
豆包大模型

字节跳动自主研发的一系列大型语言模型

通义千问
通义千问

阿里巴巴推出的全能AI助手

腾讯元宝
腾讯元宝

腾讯混元平台推出的AI助手

文心一言
文心一言

文心一言是百度开发的AI聊天机器人,通过对话可以生成各种形式的内容。

讯飞写作
讯飞写作

基于讯飞星火大模型的AI写作工具,可以快速生成新闻稿件、品宣文案、工作总结、心得体会等各种文文稿

即梦AI
即梦AI

一站式AI创作平台,免费AI图片和视频生成。

ChatGPT
ChatGPT

最最强大的AI聊天机器人程序,ChatGPT不单是聊天机器人,还能进行撰写邮件、视频脚本、文案、翻译、代码等任务。

相关专题

更多
pixiv网页版官网登录与阅读指南_pixiv官网直达入口与在线访问方法
pixiv网页版官网登录与阅读指南_pixiv官网直达入口与在线访问方法

本专题系统整理pixiv网页版官网入口及登录访问方式,涵盖官网登录页面直达路径、在线阅读入口及快速进入方法说明,帮助用户高效找到pixiv官方网站,实现便捷、安全的网页端浏览与账号登录体验。

463

2026.02.13

微博网页版主页入口与登录指南_官方网页端快速访问方法
微博网页版主页入口与登录指南_官方网页端快速访问方法

本专题系统整理微博网页版官方入口及网页端登录方式,涵盖首页直达地址、账号登录流程与常见访问问题说明,帮助用户快速找到微博官网主页,实现便捷、安全的网页端登录与内容浏览体验。

135

2026.02.13

Flutter跨平台开发与状态管理实战
Flutter跨平台开发与状态管理实战

本专题围绕Flutter框架展开,系统讲解跨平台UI构建原理与状态管理方案。内容涵盖Widget生命周期、路由管理、Provider与Bloc状态管理模式、网络请求封装及性能优化技巧。通过实战项目演示,帮助开发者构建流畅、可维护的跨平台移动应用。

64

2026.02.13

TypeScript工程化开发与Vite构建优化实践
TypeScript工程化开发与Vite构建优化实践

本专题面向前端开发者,深入讲解 TypeScript 类型系统与大型项目结构设计方法,并结合 Vite 构建工具优化前端工程化流程。内容包括模块化设计、类型声明管理、代码分割、热更新原理以及构建性能调优。通过完整项目示例,帮助开发者提升代码可维护性与开发效率。

20

2026.02.13

Redis高可用架构与分布式缓存实战
Redis高可用架构与分布式缓存实战

本专题围绕 Redis 在高并发系统中的应用展开,系统讲解主从复制、哨兵机制、Cluster 集群模式及数据分片原理。内容涵盖缓存穿透与雪崩解决方案、分布式锁实现、热点数据优化及持久化策略。通过真实业务场景演示,帮助开发者构建高可用、可扩展的分布式缓存系统。

26

2026.02.13

c语言 数据类型
c语言 数据类型

本专题整合了c语言数据类型相关内容,阅读专题下面的文章了解更多详细内容。

29

2026.02.12

雨课堂网页版登录入口与使用指南_官方在线教学平台访问方法
雨课堂网页版登录入口与使用指南_官方在线教学平台访问方法

本专题系统整理雨课堂网页版官方入口及在线登录方式,涵盖账号登录流程、官方直连入口及平台访问方法说明,帮助师生用户快速进入雨课堂在线教学平台,实现便捷、高效的课程学习与教学管理体验。

14

2026.02.12

豆包AI网页版入口与智能创作指南_官方在线写作与图片生成使用方法
豆包AI网页版入口与智能创作指南_官方在线写作与图片生成使用方法

本专题汇总豆包AI官方网页版入口及在线使用方式,涵盖智能写作工具、图片生成体验入口和官网登录方法,帮助用户快速直达豆包AI平台,高效完成文本创作与AI生图任务,实现便捷智能创作体验。

524

2026.02.12

PostgreSQL性能优化与索引调优实战
PostgreSQL性能优化与索引调优实战

本专题面向后端开发与数据库工程师,深入讲解 PostgreSQL 查询优化原理与索引机制。内容包括执行计划分析、常见索引类型对比、慢查询优化策略、事务隔离级别以及高并发场景下的性能调优技巧。通过实战案例解析,帮助开发者提升数据库响应速度与系统稳定性。

53

2026.02.12

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
PHP面向对象基础课程(更新中)
PHP面向对象基础课程(更新中)

共12课时 | 0.7万人学习

php初学者入门课程
php初学者入门课程

共10课时 | 0.7万人学习

关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号