书签 分享 收藏 举报 版权申诉 / 21

类型安装过程及后台修改.docx

  • 文档编号:18298651
  • 上传时间:2023-08-15
  • 格式:DOCX
  • 页数:21
  • 大小:1.49MB
');".$n;

echo"vary=".date("Y").";//年".$n;

echo"varm=".date("n").";//月".$n;

echo"vard=".date("j").";//日".$n;

echo"varw=".date("w").";//星".$n;

echo"varh=".date("H").";//时".$n;

echo"vari=".date("i").";//分".$n;

echo"vars=".date("s").";//秒".$n;

echo"varhstr=istr=sstr=a='';".$n;

echo"varww=Array('日','一','二','三','四','五','六');".$n;

echo"functionclock(){".$n;

echo"s++;".$n;

echo"if(s==60){i+=1;s=0;}//秒进位".$n;

echo"if(i==60){h+=1;i=0;}//分进位".$n;

echo"if(h==24){w+=1;d+=1;h=0;}//时进位".$n;

echo"if(w==7){w=0;}//星期进位".$n;

echo"if(m==2){//是否是二月份?

".$n;

echo"if(!

y%4>0){//不是闰月(二月有28天)".$n;

echo"if(d==30){".$n;

echo"m+=1;".$n;

echo"d=1;}".$n;

echo"}".$n;

echo"else{//是闰月(二月有29天)".$n;

echo"if(d==29){".$n;

echo"m+=1;".$n;

echo"d=1;}".$n;

echo"}".$n;

echo"}".$n;

echo"else{//非2月份的月份".$n;

echo"if(m==4||m==6||m==9||m==11){//只有30天的月份".$n;

echo"if(d==31){".$n;

echo"m+=1;".$n;

echo"d=1;}".$n;

echo"}".$n;

echo"else{//有31天的月份".$n;

echo"if(d==32){".$n;

echo"m+=1;".$n;

echo"d=1;}".$n;

echo"}".$n;

echo"}".$n;

echo"if(m==13){y+=1;m=1;}//月进位".$n;

echo"if(h<10){hstr='0'+h}else{hstr=''+h};".$n;

echo"if(i<10){istr=':

0'+i}else{istr=':

'+i};".$n;

echo"if(s<10){sstr=':

0'+s}else{sstr=':

'+s};".$n;

echo"if(h<13){astr='am';}else{astr='pm';};".$n;

echo"document.getElementById('TimeShow').innerHTML=''+y+'年'+m+'月'+d+'日'+'星期'+ww[w]+''+hstr+istr+sstr+astr;".$n;

echo"setTimeout('clock()',1000);".$n;

echo"}".$n;

echo"clock();".$n;

echo"".$n;

?

>

效果如图:

登陆界面加验证码

在login.tpl.php中加验证码代码

80px;height:

25px;float:

left;border:

#666;"name="imgcode">

right;margin-right:

20px;cursor:

pointer;"onclick="changeimg(this)"alt="点此刷新验证码"/>

创建code.php文件

php

session_start();

//Setthecontent-type

header("Content-type:

image/png");//告诉浏览器当前文件产生的结果以png形式进行输出

//Createtheimage

$im=imagecreate(110,30);//创建一张宽为110,高为30的画布

//Createsomecolors

$bg=imagecolorallocate($im,155,100,255);//给画布加上背景颜色

$white=imagecolorallocate($im,255,255,255);//三原色白色

//$grey=imagecolorallocate($im,128,128,128);

$black=imagecolorallocate($im,0,0,0);//黑色

$numer_array=range(0,9);//生成一个0到9范围的数组

$abc=range('a','z');//生成一个a到z范围的数组

$big_abc=range('A','Z');//生成一A到Z范围的数组

$big_chars=array_merge($numer_array,$abc,$big_abc);//将上述三个数组进行合并

$font='simhei.ttf';//设定字体文件的路径

$myimagecode='';

for($i=0;$i<4;$i++){

$str=$big_chars[rand(0,61)];//从合并后的数组中随机取一个字符

$myimagecode=$myimagecode.$str;//将这个验证码字符窜存入变量myimagecode中

$a=50*$i;

$b=50*($i+1);

imagettftext($im,30,0,mt_rand($a,$b),mt_rand(20,30),$black,$font,$str);//将取出的字符写在画布上

}

$_SESSION['thisimagecode']=$myimagecode;

for($i=0;$i<110;$i++){

imagesetpixel($im,mt_rand(0,110),mt_rand(0,30),$white);//给画布加上点

}

for($i=0;$i<4;$i++){

imageline($im,mt_rand(0,110),mt_rand(0,30),mt_rand(0,110),mt_rand(0,30),$black);//给画面加上线条

}

imagepng($im);//将图像以png形式输出

imagedestroy($im);//将图像资源从内存中销毁,以节约资源

?

>

在login.php文件中添加验证码验证代码

php

/**

*ZCNCMS

*用户登陆

*php>=5.0

*@authorLEI

*@version1.1.2

*@time20111004

*/

//初始化

$pagetitle='系统登陆';

$loginerror='';

//功能部分

if(isset($submit)){

include(WEB_MOD.'users.class.php');

$users=newUsers();

$password=md5($password);

$userslogin=array();

$userslogin=$users->yz($username,$password,$imgcode);

if(!

empty($userslogin)&&count($userslogin)>0){

$_SESSION['admin_username']=$userslogin['username'];

$_SESSION['admin_classid']=$userslogin['classid'];

$_SESSION['admin_power']=$userslogin['power'];

$_SESSION['admin_id']=$userslogin['id'];

//记录登陆信息

$imgcode=strtolower($_POST['imgcode']);//接受从登陆输入框提交过来的验证码并转化为小写;

$myimagecode=strtolower($_SESSION['thisimagecode']);//从session中取得验证码并转化为小写;

if($imgcode!

=$myimagecode){

echo'请输入正确的验证码';exit;

}

include(WEB_MOD.'users_log.class.php');

$users_log=newUsers_log();

$users_last_log=$users_log->GetLastLog(array(),"`action`='login'anduserid=".$userslogin['id']);

$_SESSION['admin_last_log']=$users_last_log;

$timenow=time();

$info=array(

'userid'=>$userslogin['id'],

'action'=>'login',

'ipaddr'=>GetIP(),

'addtime'=>$timenow

);

//print_r($_SESSION['members_last_log']);

//print_r($info);

$users_log->Add($info);

header("location:

./");

exit;

}else{

//echo1;

$loginerror='用户名密码错误,请重新登陆.';

$templatefile='login.tpl.php';

}

}else{

$templatefile='login.tpl.php';

}

?

>

验证码添加点击刷新功能

在login.tpl.php文件中添加如下代码:

80px;height:

25px;float:

left;border:

#666;"name="imgcode">

right;margin-right:

20px;cursor:

pointer;"onclick="changeimg(this)"alt="点此刷新验证码"/>

配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
安装 过程 后台 修改
提示  冰点文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:安装过程及后台修改.docx
链接地址:https://www.bingdoc.com/p-18298651.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2


收起
展开