require_once("smarty_pl_class.php"); $smarty=new Smarty_EnCollege(); #获取将士基本信息 $HOST=$_SERVER['HTTP_HOST']; $smarty->assign('HOST',$HOST); $http_query=$_SERVER['QUERY_STRING']; $smarty->assign('http_query',$http_query); //$getuser=explode("&",$http_query); //$uscode=$getuser[0]; $uscode=$_GET['code']; $load=($_GET['load'])?$_GET['load']:"userinfo"; if($_GET['cltype']=='0'){ $load='read'; } $page=($_GET['page'])?$_GET['page']:1; $aid=($_GET['aid'])?$_GET['aid']:0; $id=($_GET['id'])?$_GET['id']:0; $pageid=($_GET['pageid'])?$_GET['pageid']:1; $smarty->assign('pageid',$pageid); $keyword=$_POST['keyword']; if(strlen($keyword)>1){ $smarty->assign('keyword',$keyword); } //echo $uscode."
|".$load;
$rand="{$uscode}/";
$query=(($load)?$load:"").(($id)?$id:"").(($page)?$page:"").(($keyword)?$keyword:"").(($pageid)?$pageid:"").(($aid)?$aid:"");
$db=new mysqldb($dbhost, $dbuser, $dbpw,'ceot_tblog');
$db->query("set names gbk");
$db->query("update b_user set u_hit=u_hit+1 where u_code='$uscode'");
$stated=$db->get_one("select u_stated,DATE_FORMAT(hit_day,'%d') as hit_day,DATE_FORMAT(hit_mouth,'%m') as hit_mouth from b_user where u_code='$uscode'");
if($stated['u_stated']<1){
echo '该讲师blog暂停使用,3秒后返回blog主页
';
echo '';
exit;
}
#增加日统计和月统计
/*$day=date("d",time()+8*3600);
$mouth=date("m",time()+8*3600);
if($day==$stated['hit_day']){
$db->query("update b_user set hit_day_num=hit_day_num+1 where u_code='$uscode'");
}else{
$db->query("update b_user set hit_day=now(),hit_day_num=100 where u_code='$uscode'");
}
if($mouth==$stated['hit_mouth']){
$db->query("update b_user set hit_mouth_num=hit_mouth_num+1 where u_code='$uscode'");
}else{
$db->query("update b_user set hit_mouth=now(),hit_mouth_num=200 where u_code='$uscode'");
}*/
##检测登陆
$online=$_COOKIE['online'];
$sql="SELECT B.u_code AS code,B.uid AS uid
FROM ceot_user.us_login L,
ceot_tblog.b_user B
WHERE L.Sess='$online' AND L.UserID=B.uid";
$admin=$db->get_one($sql);
$smarty->assign('admin_code',$admin['code']);
if (!$smarty->is_cached('index.tpl.php',$rand,$query)){
#有效验证
$smarty->assign('lg_username',$_COOKIE["username"]);
$smarty->assign('lg_password',$_COOKIE["password"]);
$smarty->assign('lg_logintime',$_COOKIE["logintime"]);
$smarty->assign("uscode",$uscode);
$sql="select * from b_user where u_code='$uscode' ";
$userinfo=$db->get_one($sql);
include "./module/blog_read.inc.php";
include "./module/blog_read.inc.php";
if($id>0 && $load!="photo_read"){
$load.="_connect";
$load_file="module/blog_".$load.".inc.php";//取详细信息
}else{
$load_file="module/blog_".$load.".inc.php";
}
$smarty->assign("load",$load);
if(($load!="userinfo") && isset($load)){
include $load_file;
}
//print_r($userinfo);
#讲师姓名联系方式
$db->select_db('ceot_user');
$db->query("set names gbk");
$sql="select true_name,province,telephone,move_telephone,city
from us_contact
where web_id='".$userinfo['uid']."'
";
if($info=$db->get_one($sql)){
$userinfo=array_merge($userinfo,$info);
}
$sql="select Email from us_userinfo where id='".$userinfo['uid']."'";
if($info=$db->get_one($sql)){
$userinfo=array_merge($userinfo,$info);
}
//print_r($userinfo);
$smarty->assign("userinfo",$userinfo);
$db->select_db('ceot_album');
$sql="select pic_source from u_photo where uid='".$userinfo['uid']."' and type=3 and isshow=1";
$photo=$db->get_one($sql);
$smarty->assign("userimage",$photo['pic_source']);
#评论
$db->select_db('ceot_cmt');
$db->query("set names gbk");
$sql="select count(c.id) as num
from ceot_cmt.cm_content c
where tid in (
select a.id
from ceot_tblog.b_article a
where a.uid='".$userinfo['uid']."')";
$pinglun_num=$db->get_one($sql);
//$pinglun_num['num']=1000;//temp line
//pageft($article_num['num'],20,"http://".$HOST."/index.php?".$uscode."&load=read");
$sql="select c.id, c.uid, c.cid, c.tid, c.connect
from ceot_cmt.cm_content c
where tid in (
select a.id
from ceot_tblog.b_article a
where a.uid='".$userinfo['uid']."')
order by c.id desc limit 0,10
";
//$sql="select * from cm_content where cid='11' and tid='".$userinfo['uid']."' order by id desc limit 0,10";
$pinglun=$db->doSql($sql);
$smarty->assign("pinglun_num",$pinglun_num['num']+0);
$smarty->assign("pinglun",$pinglun);
unset($pinglun_num,$pinglun);
#留言
$sql="select count(id) as num from cm_content where cid='4' and tid='".$userinfo['uid']."'";
//echo $sql;
$liuyan_num=$db->get_one($sql);
//$liuyan_num['num']=1000;//temp line
$smarty->assign("liuyan_num",$liuyan_num['num']+0);
unset($liuyan_num);
//查看联系方式
$online=$_COOKIE["online"];
if (strlen($online)>8){
$onlineuser_res=$db->query("select UserID from ceot_user.us_login " .
" where Sess='$online' order by id desc limit 0,1");
if($db->num_rows($onlineuser_res)==1){
$onlineuser=$db->fetch_array($onlineuser_res);
$user_ID=$onlineuser["UserID"];
}
}
$sql="select count(id) as rows from ceot_user.sc_cost where cid='{$userinfo['uid']}' and UserID='{$user_ID}'";
$row=$db->get_one($sql);
//$row['rows']=1000;//temp line
$smarty->assign("teainfo",$row['rows']+0);
unset($userinfo,$row);
$db->close();
}
$smarty->display('index.tpl.php',$rand,$query);
?>