public function __db(){ 

 global $_G; 


 $link = mysql_connect("localhost","root","4b907287b4"); 

 //连接 

 mysql_select_db('hs_discuz_bbs'); 

 //选择数据库 

 //mysql_query("SET NAMES 'utf8'"); 

 //设置编码(需要和本页面的编码一致 

 //$query1 = "select count(*) from " 



 $sql = "select max(id) as maxid from url_log"; 

 //echo "71" .$sql; 

 $get_list_res = mysql_query($sql ,$link); 


 $maxid =1; 

 while($recs = mysql_fetch_array($get_list_res)) { 

 $maxid = $recs["maxid"] + 1; 

 } 


 $query = "insert into url_log(id, username, url) values('".$maxid."','".$_G['uid']."', '".$_SERVER['HTTP_REFERER']."')"; 

 //$query = "insert into url_log(id, username, url) values('1','username','aa')"; 

 mysql_query($query,$link); 

 /************************ 

 * 自己的代码 

 ************************/ 


 /* 关闭连接 */ 

 mysql_close($link); 

 }