<?php
	header("content-type:text/html;charset=utf-8");
	require("foundation/asession.php");
	require("configuration.php");
	require("includes.php");
	require("foundation/module_users.php");
	require("foundation/fcontent_format.php");
	require("foundation/fplugin.php");
	if(get_sess_userid()){
		echo '<script type="text/javascript">window.location.href="main.php";</script>';
	}
	$tg=get_args('tg');
	$onload_run_script='initform();';
	if($tg=='login'){$onload_run_script='showLogin();';}
	if($tg=='reg'){$onload_run_script='showReg();';}

	//语言包引入
	$l_langpackage=new loginlp;
	$re_langpackage=new reglp;
	$pu_langpackage=new publiclp;
	
	if($tg=='invite'){
		$index_ref="modules/invite.php";
	}elseif($tg=='search_pals'){
		$index_ref="modules/mypals/search_pals_list.php";
	}else{
		$index_ref="modules/default.php";
  	}
  	//数据表定义区
	$t_recommend = $tablePreStr."recommend";
	$t_users = $tablePreStr."users";
	$t_config = $tablePreStr."config";
	$t_plugins=$tablePreStr."plugins";
	
	$dbo = new dbex;
	//读写分离定义函数
	dbtarget('r',$dbServs);
	$rec_rs=array();
	$rec_rs0=array();
	$rec_rs1=array();
	
	if(is_null(get_sess_plugins()))$plugins="''";
		else $plugins=get_sess_plugins();
		$sql="select * from $t_plugins where plugin_id in('1','2','3') and valid=1 and name not in (".$plugins.")";
		$rows=$dbo->getRs($sql);
		$plugin_menu=array();
		$plugin_content=array();
		$plugin_floor=array();
		foreach($rows as $row)
		{
			if($row['plugin_id']==1) $plugin_menu[]=$row;
			else if($row['plugin_id']==2) $plugin_guest[]=$row;
			else if($row['plugin_id']==3) $plugin_friends[]=$row;
		}
	
	//首页会员推荐
	$sql="select * from $t_recommend order by rec_order";
	$rec_rs=$dbo->getRs($sql);
  	foreach ($rec_rs as $key=>$val){
  		if ($val['rec_class']=='0'){
  			$rec_rs0[$key]=$val;
  		}
  	}
	//首页幻灯片	
  	foreach ($rec_rs as $key=>$val){
  		if ($val['rec_class']=='1'){
  			$rec_rs1[$key]=$val;
  		}
  	}
  
  //最新会员列表
	$sql="select * from $t_users order by user_add_time desc limit 0,4";
	$user_rs=$dbo->getRs($sql);
?>
