<?php
include("./include/config.inc.php");
include("./include/function.php");
include("./data/config.php");
include("global.php");


@$job = $submitted_vars["job"];


if( $job == 'updatehits' ){

	$aid = $_GET['aid'];
	//取得 fid mid
	$query   =  "SELECT * FROM `w6_module_content_index` WHERE `id`='".$aid."'";
	$result  =  mysql_query($query);
	$fid     =  mysql_result($result,"0","fid");
	$mid     =  mysql_result($result,"0","mid");
	
	$query   =  "SELECT `aid`,`count` FROM `w6_module_content_$mid` WHERE `aid`=$aid";

	$result  =  mysql_query($query);
	$count   =  mysql_result($result,"0","count");

	$count++;
	$query="UPDATE `w6_module_content_$mid` SET `count` = $count , `lastview` = ".time()." WHERE `aid` = $aid ";//同时还要更新浏览时间
	$result=mysql_query($query);
	
	echo "<SCRIPT LANGUAGE=\"JavaScript\">parent.document.getElementById('hits').innerHTML='".$count."';</SCRIPT>";


}elseif( $job == 'makeIndexHtml' ){

	if($webdb['MakeIndexHtmlTime']>0){
	$time=$webdb['MakeIndexHtmlTime']*60;
	if((time()-@filemtime("index.htm"))>$time){
		echo "<div style='display:none'><iframe src=$webdb[www_url]/index.php?job=makeIndexHtml></iframe></div>";
	}
}
	
}

//自动更新文章
@include("./include/fun_auto.php");  


?>