在帝国的html里加入html代码
<div class="login">
<form id="login-form" action="/login.shtml" method="post"> <div class="row username">
<label for="LoginForm_username" class="required">用户名 <span class="required">*</span></label> <input size="30" class="px" autocomplete="off" tabindex="1" name="LoginForm[username]" id="LoginForm_username" type="text" /> <a style="margin: 3px auto 0px; padding: 0px 3px; outline: none; line-height: 21.6px; clear: both; border-width: 1px; border-style: solid; border-color: rgb(0, 153, 204); background: rgb(246, 251, 255); overflow: hidden; font-family: tahoma, arial, "Microsoft YaHei";">
代码如下:
<?php
require './source/class/class_core.php';
$discuz = & discuz_core::instance();
$discuz->init_cron = false;
$discuz->init_session = false;
$discuz->init();
//echo $_G['uid'];
echo $_G['uid'].'|'.$_G['username'].'|0';
?>
在页面下方利用ajax获取该页面的值,不多说了,直接看代码吧
<script>
$(document).ready(function(){
var bbsurl='http://bbs.zzvips.com/';
var url=bbsurl+'/zxf_userinfo.php';
var uid,uname,uscore;
$.ajax({type: "GET",url: url,data: "?"+Math.random(),dataType: "text",success: function(a){
for (var c = a.split("|"), d = 0; d < c.length;){uid = c[d++],uname= c[d++],uscore= c[d++];}
if(uid){
$('.login').remove();
$('.info').show();
$('.info_info_name').html(uname);
$('.info_img').html('<a href="#"><img src='+bbsurl+'/uc_server/avatar.php?uid='+uid+'&size=small /></a>');
}
else{
$('.info').remove();
$('.login').show();
}
}});
});
</script>