|
织梦dedecms在启用二级域名后 由于DEDEAjax不能跨域所以使用ajax返回登录数据不能成功,对ajax跨域实在是找不到比较好的方法所以暂时采用以下方法替代:
第一步,在member文件夹处建立一个php文件,名字为“ajax_index_loginsta_s.php”。
第二步,给这个文件中填写的代码为:
- 01
- <?php
- 02
- require_once(dirname(__FILE__)."/config.php");
- 03
- AjaxHead();
- 04
- if($myurl == '')
- 05
- {
- 06
- echo "document.write('<div id=_userlogin>');";
- 07
- echo "document.write('<form name=userlogin action=".$GLOBALS['cfg_cmsurl']."/member/index_do.php method=POST>');";
- 08
- echo "document.write('<input type=hidden name=fmdo value=login />');";
- 09
- echo "document.write('<input type=hidden name=dopost value=login />');";
- 10
- echo "document.write('<input type=hidden name=keeptime value=604800 />');";
- 11
- echo "document.write('<div class=s1>用户名</div><div class=s2><input type=text name=userid /></div> ');";
- 12
- echo "document.write('<div class=s1>密码</div><div class=s2><input name=pwd type=password /></div> ');";
- 13
- echo "document.write('<div class=s1>验证码</div><div class=s2 id=s2><input name=vdcode type=text maxlength=4 /></div>');";
- 14
- echo "document.write('<div class=simg><img src=".$GLOBALS['cfg_cmsurl']."/include/vdimgck.php width=50 height=20 /></div><div class=s3><input type=submit value=登录 /> </div>');";
- 15
- echo "document.write('<div class=s1><a href=".$GLOBALS['cfg_cmsurl']."/member/resetpassword.php target=_blank>忘记密码?</a> <a href=".$GLOBALS['cfg_cmsurl']."/member/index_do.php?fmdo=user&dopost=regnew target=_blank><font color=#FF0000>免费注册</font></a></div>');";
- 16
- echo "document.write('</form></div>');";
- 17
- exit('');
- 18
- }
- 19
- $uid = $cfg_ml->M_LoginID;
- 20
- $face = $cfg_ml->fields['face'] == '' ? $GLOBALS['cfg_memberurl'].'/images/nopic.gif' : $cfg_ml->fields['face'];
- 21
- echo "document.write('<div class=s5><b>".$cfg_ml->M_UserName."</b> 欢迎登陆XXXXXXXX!<a href=".$cfg_memberurl."/index.php>会员中心</a> | <a href=".$cfg_memberurl."/edit_fullinfo.php>帐户</a> | <a href=".$myurl.">我的Blog</a> | <a href=".$cfg_memberurl."/index_do.php?fmdo=login&dopost=exit><font color=#FF0000>退出登陆</font></a></div>');";
- 22
- ?>
复制代码
适当的自己修改吧,我这个主要用在顶部登陆,所以都是横着放的。
第三步,把所有需要添加登陆的页面中增加一行代码:
查看源码打印代码帮助
- <script language="javascript" type="text/javascript" src="http://你的域名/member/ajax_index_loginsta_s.php"></script>
复制代码
|
|