Location: PHPKode > projects > Chinese Project Forum > upload/main.php
<?
require("global.php");

$recordset = &$conn->Execute("
	SELECT 
	".$prefix."_boards.*,
	".$prefix."_posts.threadparentid,
	".$prefix."_posts.userid,
	".$prefix."_posts.posttime,
	".$prefix."_threads.threadname,
	".$prefix."_threads.topicicon,
	".$prefix."_threads.boardparentid as parentid,
	".$prefix."_user_table.username	
	FROM ".$prefix."_boards
	LEFT JOIN ".$prefix."_posts ON (".$prefix."_posts.postid=".$prefix."_boards.lastpostid) 
	LEFT JOIN ".$prefix."_threads ON (".$prefix."_threads.threadid=".$prefix."_posts.threadparentid) 
	LEFT JOIN ".$prefix."_user_table ON (".$prefix."_user_table.userid=".$prefix."_posts.userid) 
	ORDER by boardparentid ASC, sort ASC");
while (!$recordset->EOF) {
  $row = $recordset->fields;
  $boardcache[$row[boardparentid]][$row[sort]][$row[boardid]] = $row;
  $recordset->MoveNext();
}

$recordset = &$conn->Execute("SELECT boardid FROM ".$prefix."_object2board WHERE objectid = '$user_group' AND boardpermission = 1");
while (!$recordset->EOF) {
  $row = $recordset->fields;
  $permissioncache[$row[boardid]] = 1;
  $recordset->MoveNext();
}

$recordset = &$conn->Execute("SELECT userid, username, boardid FROM ".$prefix."_object2board LEFT JOIN ".$prefix."_user_table ON (".$prefix."_object2board.objectid = ".$prefix."_user_table.userid) WHERE mod = 1 ORDER BY username ASC");
while (!$recordset->EOF) {
  $row = $recordset->fields;
  $modcache[$row[boardid]][] = $row;
  $recordset->MoveNext();
}

$main_boardbit = makeforumbit(0);
$recordset->close();

$last_visited = formatdate($old_time,$longdateformat); //?
$newestuser = $conn->Execute("SELECT userid,username FROM ".$prefix."_user_table WHERE activation='1' ORDER by regdate DESC LIMIT 1");
$newestuser = "<a href=\"members.php?mode=profile&userid=$newestuser[userid]$session\">$newestuser[username]</a>";
$anzahluser = $conn->Execute("SELECT COUNT(userid) FROM ".$prefix."_user_table WHERE activation='1'");
$anzahlthreads = $conn->Execute("SELECT COUNT(threadid) FROM ".$prefix."_threads");
$anzahlposts = $conn->Execute("SELECT COUNT(postid) FROM ".$prefix."_posts");
$anzahluser = $anzahluser[0];
$anzahlthreads = $anzahlthreads[0];
$anzahlposts = $anzahlposts[0];

$rekordtime = formatdate($rekordtime,$longdateformat); 

$guests = $conn->Execute("SELECT COUNT(zeit)as anzahl FROM ".$prefix."_useronline WHERE userid=''");
$user = $conn->Execute("SELECT COUNT(zeit)as anzahl FROM ".$prefix."_useronline WHERE ip=''");
$useronline = $guests[anzahl] + $user[anzahl];

#Óû§ÔÚÏßÏÔʾ
$recordset = &$conn->Execute("select ".$prefix."_useronline.userid, username, invisible from ".$prefix."_useronline LEFT JOIN ".$prefix."_user_table ON (".$prefix."_useronline.userid = ".$prefix."_user_table.userid) WHERE ".$prefix."_useronline.ip = '' ORDER BY username ASC"); 
while(!$recordset->EOF) {
  $row = $recordset->fields;
  if($row[invisible]) continue;
  if($user_on) $user_on .= ", ";
  $user_on .= getrankimage($row[userid])."<a href=\"members.php?mode=profile&userid=$row[0]$session\">$row[1]</a>";
  $recordset->MoveNext();
}
$recordset->close();
#Óû§ÐÅÏ¢
$from = ip_check($REMOTE_ADDR);
$os = osinfo();
$browser = browseinfo();
#¸öÈ˶ÌÏûÏ¢ $user_id ÔÚSessionÄÚ×¢²á
if($user_id) {
	$totalpm = $conn->Execute("SELECT COUNT(pmid) FROM ".$prefix."_pms WHERE recipientid = '$user_id'");
	$newpm = $conn->Execute("SELECT COUNT(pmid) FROM ".$prefix."_pms WHERE recipientid = '$user_id' AND sendtime >= '$old_time' AND view = 0");
	$unreadpm = $conn->Execute("SELECT COUNT(pmid) FROM ".$prefix."_pms WHERE recipientid = '$user_id' AND view = 0");
	$totalpm = $totalpm->fields[0];
	$newpm = $newpm->fields[0];
	$unreadpm = $unreadpm->fields[0];
}
if ($newpm!=0) $js_pmBox="<script language=\"JavaScript\">
<!-- Begin
 pmBox.bgColor='#1875BD';
 setInterval(\"Timer()\", 500);
 x=1;
function Timer() {
set=1;
if(x==0 && set==1) {
pmBox.bgColor='#EAD230';
x=1;
set=0;
}
if(x==1 && set==1) {
pmBox.bgColor='#FFFFFF';
x=0;
set=0;
}
}
// End -->
</script>";
if(!$user_id) eval ("\$quick_login = \"".gettemplate("main_unreg")."\";");
else eval ("\$quick_login = \"".gettemplate("main_logtin")."\";");

eval("dooutput(\"".gettemplate("main")."\");"); 
?>
Return current item: Chinese Project Forum