define( array( 'main' => "main.tpl", 'table' => "boardTable.tpl")); $tpl->define_dynamic( "row" , "table" ); db_connect($dbname); //--hw1takeout //trackAnon(); //--- if(!isLogin()) echo ""; $query ="select distinct b.forum_id, b.cat_order, b.category, b.forum_name, b.totalpost, b.last_poster, b.description, ". "unix_timestamp(b.last_date) as last_date from board as b, category as c where b.status = 1 and b.category = c.id". " order by c.display_order , b.cat_order"; $result = mysql_query($query); if(!$result) myDie("Error in selecting data from board table
"); //assign values to variables representing Columns $tpl->assign( array( 'FORUM' => "Forum", 'POSTS' => "Posts", 'LASTVISITDATE' => ($SESSION['lastlogin']!="")?(date("d M Y h:i A", $SESSION[lastlogin])):" - ", //user's last login time 'MODERATOR' => "Moderator")); $thisCat =0; $lastCat =0; //track the changing of category. $start = utime(); if (!mysql_error() && mysql_num_rows($result) > 0) { for ($i = 0; $i < mysql_num_rows($result); $i++ ) { if ($row = mysql_fetch_array($result)) { $thisCat = $row['category']; if ($i == 0 || $thisCat != $lastCat) //goin to the next category { $lastCat = $thisCat; $t = "[$thisCat]"; $tpl->assign('CATEGORYNAME', getCategoryName($thisCat)." " ); $tpl->assign('COMMENT_START', ""); $tpl->assign('COMMENT_END', ""); } else { $tpl->assign('COMMENT_START', ""); } (isForumPrivate($row['forum_id']) )? $lastposter ="Classified":$lastposter = $row['last_poster']; if($lastposter =="" && $row['last_date']!=0) $lastposter="Unregistered User"; $bulb = ($SESSION['lastlogin'] < $row['last_date'] ) ? $newPostIcon:$noNewPostIcon; $tpl->assign( array( 'BULB' => $bulb, 'COL1' => "".$row['forum_name']."", 'COL2' => $row['totalpost'], 'COL3' => ($lastposter =="" && $row['last_date']==0)?"-":$lastposter." at
".(date("d M Y h:i A",$row['last_date']+($timeoffset * 3600) )), 'FORUMDESC' => $row['description'] )); //COL4 => $row['moderator'] )); $tpl->parse('ROW', ".row"); } } } else myDie ("No forums have been configured for this Board!, login as admin here and then go to control panel to add forums."); //echo "done - ".(($tpl->utime() - $start) * 1000 )." ms
" ; $usericon = ( ($SESSION['usericon']=="") || $SESSION['usericon'] =="")? "anon":$SESSION['usericon']; ($SESSION['username']!="")? $tpl->assign('USERNAME',$SESSION['username']):$tpl->assign('USERNAME',"Anonymous"); //quick hack to access hard1 db for anon count // -- uncomment for Hardware-One db_connect("hard1"); $anonCount = getNumFromRow("select count(*) from session_users where unix_timestamp(now()) - unix_timestamp(times) <=10800"); db_connect($dbname); // /*/-generic $anonCount = getNumFromRow("select count(*) from anon_users_online where unix_timestamp(now()) - unix_timestamp(times) <=1800"); @mysql_query("delete from anon_users_online where unix_timestamp(now()) - unix_timestamp(times) >=3600 ");//purge old sessions */ $lastmember = getStrFromRow("select username from users where userpassword !='' order by user_id desc limit 1"); $tpl->assign('LATESTMEMBER',$lastmember ); $tpl->assign('LASTMEMURL',"showprofile.php?user=".(urlencode($lastmember)) ); $memberCount = getNumFromRow("select count(*) from users_online where (unix_timestamp(NOW()) - unix_timestamp(lastlogin) <= 1800) and (keepcookie != 'out')" ); ($memberCount > 1)? $useronlineStr ="$memberCount members, ":$useronlineStr ="$memberCount member, "; ($anonCount > 1)? $useronlineStr .="$anonCount anonymous users ":$useronlineStr .="$anonCount anonymous user "; $tpl->assign('USERSONLINE',$useronlineStr); //-- PM Check if ($SESSION['username'] == "") { $tpl->assign('PMBULB', "forumicons/pmoldmsg.gif"); $tpl->assign('PMCOUNTSTR', "Please login to check your "); } else { //$newPMCount = getNumFromRow("select count(*) from privatercvd where toid=".(getUserid($SESSION['username']))." AND unix_timestamp(datetime) >= $SESSION[lastlogin]" ); $newPMCount = getNumFromRow("select count(*) from privatercvd where toid=".(getUserid($SESSION['username']))." AND hasread=0 AND repliedto =0" ); // if($newPMCount >0) { $tpl->assign('PMBULB', "forumicons/pmnewmsg.gif"); $tpl->assign('PMCOUNTSTR', ($newPMCount>1)?"You have $newPMCount new messages in your ":"You have 1 new message in your "); } else { $tpl->assign('PMBULB', "forumicons/pmoldmsg.gif"); $tpl->assign('PMCOUNTSTR', "You have no new messages in your "); } } //-- $tpl->assign('FORUMSKIN', "template/$forumSkin"); $tpl->assign('USERICON',$usericon); $tpl->assign('TITLE',"$boardname"); $tpl->assign('BOARDNAME',"$boardname"); $tpl->assign('BANNERCODE',$bannercode); $tpl->assign('FOOTERCODE',$footercode); $tpl->assign('TIMEZONE',$timezone); $tpl->parse('MAIN', array("table","main")); //stored the parsed row->table->main into {MAIN} $tpl->FastPrint(); mysql_free_result($result); //echo "$SESSION[username], $SESSION[lastlogin] $newPMCount"; ?>