jquery.ajax制作帝国cms6.6快速登录插件

其他技术 站长 浏览 评论

今天分享快速登录插件。最终效果截图:jquery.ajax制作帝国cms6.6快速登录功能效果图

其实登录与注册差不多,登录时少了邮箱验证这一环节。在源码方面,由于昨天已经修改了4个文件,今天只需要再修改2个php文件即可。下面进入主题。

一、修改帝国cms6.6系统文件

1.1 修改index.php文件

文件地址:根目录/e/enews/index.php,找到$enews=="login",大约在62行,新增以下代码。

77行左右

<ol class="ol list-paddingleft-2" style="list-style-type: none;"><li style="">$sub_reg=$_POST[&#39;sub_reg&#39;]?$_POST[&#39;sub_reg&#39;]:0;</li><li style="">login1($username,$password,$lifetime,$key,$location,$sub_reg);</li></ol>

 

代码配图:修改帝国cms6.6中的index.php文件

1.2 修改user.php文件

文件地址:根目录/e/class/user.php,找到登陆,大约在1030行,新增以下代码。

1030行左右

<ol class="ol list-paddingleft-2" style="list-style-type: none;"><li style="">function login1($username,$password,$lifetime,$key,$location,$sub_reg=0){</li></ol>

 

1042行左右

<ol class="ol list-paddingleft-2" style="list-style-type: none;"><li style="">$return_login=array();</li><li style="">@include $a.LoadLang(&quot;pub/q_message.php&quot;);</li><li style="">if(!trim($username)||!trim($password)){</li><li style="">if($sub_reg==1){</li><li style="">$return_login[&#39;msg&#39;]=1;</li><li style="">$return_login[&#39;text&#39;]=$qmessage_r[&quot;EmptyLogin&quot;];</li><li style="">echo json_encode($return_login);</li><li style="">exit;</li><li style="">}else{</li><li style="">printerror(&quot;EmptyLogin&quot;,&quot;history.go(-1)&quot;,$dopr);</li><li style="">}</li><li style="">}</li></ol>

 

1058行左右

<ol class="ol list-paddingleft-2" style="list-style-type: none;"><li style="">ecmsCheckShowKey($keyvname,$key,$dopr,0,$sub_reg);</li></ol>

 

1092行左右

 

第1106行、1117行、1164行均有修改,看官下载文件后对照查看,搜索sub_reg,出现处均表示有修改。

代码配图:修改帝国cms6.6中的user.php文件

修改完php文件后,只需要再写一个js文件即可。

二、快速登录js文件

2.1 新增ajax_cms_login.js文件

这个文件的用途还是跟昨天的一样,判断值及传递ajax中输出的信息。如果看官将ajax_cms_login.js放其它文件夹中,需要注意下第117行和第157行的路径。

三、下载插件

<ol class="ol list-paddingleft-2" style="list-style-type: none;"><li style=""><a href="http://www.yilingsj.com/d/file/jquery/2016-01-31/jquery.ajax%E5%88%B6%E4%BD%9C%E5%B8%9D%E5%9B%BDcms6.6%E5%BF%AB%E9%80%9F%E7%99%BB%E5%BD%95%E6%8F%92%E4%BB%B6demo%E6%BC%94%E7%A4%BA.html" class="demo" title="jquery.ajax制作帝国cms6.6快速登录插件demo演示" target="_blank" style="position: absolute; right: 5px; bottom: 0px; z-index: 99; color: rgb(204, 204, 204); text-decoration-line: none; outline: none; overflow: hidden; border-bottom: 1px dashed rgb(102, 102, 102); padding-bottom: 1px; margin: 0px 5px; user-select: text !important;" rel="noopener noreferrer">dem</li></ol>

 

3.1 压缩包文件说明

如果看官需要完整插件,可使用积分进行下载。下载解压后如图:ajax_login文件夹中各文件说明.png看官在移动文件的时候一定要按照图片中的说明操作,否则会因路径错误而不能实现效果。

四、特别提示

虽然今天的教程中只修改了2个php文件,实际上是在昨天的基础上修改的。如果看官没有昨天的php文件,只用今天修改的文件是达不到预期效果的!

转载请注明:网页阁吧 » jquery.ajax制作帝国cms6.6快速登录插件