織夢dedecms在啟用二級域名后 由于DEDEAjax不能跨域所以使用ajax返回登錄數(shù)據(jù)不能成功,對ajax跨域?qū)嵲谑钦也坏奖容^好的方法所以暫時采用以下方法替代:
第一步,在member文件夾處建立一個php文件,名字為“ajax_index_loginsta_s.php”。
第二步,給這個文件中填寫的代碼為:
<?php
require_once(dirname(__FILE__)."/config.php");
AjaxHead();
if($myurl == '')
{
echo "document.write('<div id=_userlogin>');";
echo "document.write('<form name=userlogin action=".$GLOBALS['cfg_cmsurl']."/member/index_do.php method=POST>');";
echo "document.write('<input type=hidden name=fmdo value=login />');";
echo "document.write('<input type=hidden name=dopost value=login />');";
echo "document.write('<input type=hidden name=keeptime value=604800 />');";
echo "document.write('<div class=s1>用戶名</div><div class=s2><input type=text name=userid /></div> ');";
echo "document.write('<div class=s1>密碼</div><div class=s2><input name=pwd type=password /></div> ');";
echo "document.write('<div class=s1>驗(yàn)證碼</div><div class=s2 id=s2><input name=vdcode type=text maxlength=4 /></div>');";
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>');";
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>免費(fèi)注冊</font></a></div>');";
echo "document.write('</form></div>');";
exit('');
}
$uid = $cfg_ml->M_LoginID;
$face = $cfg_ml->fields['face'] == '' ? $GLOBALS['cfg_memberurl'].'/images/nopic.gif' : $cfg_ml->fields['face'];
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>');";
?>
|
適當(dāng)?shù)淖约盒薷陌?,我這個主要用在頂部登陸,所以都是橫著放的。
第三步,把所有需要添加登陸的頁面中增加一行代碼:
<script language="javascript" type="text/javascript" src="http://你的域名/member/ajax_index_loginsta_s.php"></script>
|