<?php
$time_start = getmicrotime(); 
function getmicrotime(){
	list($usec, $sec) = explode(" ",microtime());
	return ((float)$usec + (float)$sec);
}

$db_config=array(
  'dsn'=>'mysql:host='.$dbhost.';dbname='.$dbname.'',
  'username'=>$dbuser,
  'password'=>$dbpw
);
$db=new PDO_DB($db_config);

$sql="select * from {$tablepre}siteconfig order by id desc limit 1"; 
$siteconfig = $db->get_row($sql);
if (!empty($siteconfig)){
   $site_name  = $siteconfig["site_name"];
   $site_url   = $siteconfig["site_url"];
   $site_icp   = $siteconfig["site_icp"];
   $site_key   = $siteconfig["site_key"];
   $site_desc  = $siteconfig["site_desc"];
   $site_num   = $siteconfig["site_num"];

   $site_admin_num = $siteconfig["site_admin_num"];
   $site_filetype  = $siteconfig["site_filetype"];
   $site_filesize  = $siteconfig["site_filesize"]*1024*1024;
   $html_flag      = $siteconfig["html_flag"];
   $linkoff        = $siteconfig["linkoff"];
   $downoff        = $siteconfig["downoff"];

   $smtpoff        = $siteconfig["smtpoff"];
   $smtpserver     = $siteconfig["smtpserver"];
   $smtpusermail   = $siteconfig["smtpusermail"];
   $smtpuser       = $siteconfig["smtpuser"];
   $smtpport       = $siteconfig["smtpport"];
   $openssl        = $siteconfig["openssl"];
   $smtppass       = $siteconfig["smtppass"];
   $baidu_api      = $siteconfig["baidu_api"];
   $baidu_token    = $siteconfig["baidu_token"];
   $index_cate_num = $siteconfig["index_cate_num"];

   $ym = $siteconfig["ym"];
   $sn = $siteconfig["sn"];
   
   //3.0
   $reset_pwd = $siteconfig["reset_pwd"];
   $ext_arr = explode("|",strtolower($site_filetype));
   foreach ($ext_arr as $v){
        $ext_str .= '.'.$v.',';
   }
   $ext_str = substr($ext_str, 0, -1);

}

$sql    = "select * from {$tablepre}advert where begintime<='".$getnow."' and endtime>='".$getnow."' order by id desc"; 
$listad = $db->get_all($sql);
if (!empty($listad)){
   foreach ($listad as $vad){
       if ($vad['adtype']==1){
          $ad['index'][]=$vad;
	   }
	   if ($vad['adtype']==2){
          $ad['listad'][]=$vad; //不能用list关键字
	   }
	   if ($vad['adtype']==3){
          $ad['view'][]=$vad;
	   }
   }
}
?>