<?php
//=====================================
// LINKER Category Engine
//=====================================
// Filename : main_right.php
// Path : Manage directory
// last update : 2002/03/13
// Desc : Total information print
//=====================================
//=====================================
// File include part
//=====================================
include ("./authen.php");
include ("../function/main_func.php");
include ("../function/$Sdb_type.php");
include ("../$Slang/m_common.php");
$db = new DB_Sql($Sdb_host,$Sdb_user,$Sdb_pass,$Sselect_db);
//=====================================
// total category
$db->query("select count(*) as total from LINKER_CAT");
$row = $db->nrecord();
$total_category = $row[total];
// total link
$db->query("select count(*) as total from LINKER_LINK");
$row = $db->nrecord();
$total_link = $row[total];
// total comment
$db->query("select count(*) as total from LINKER_COM");
$row = $db->nrecord();
$total_comment = $row[total];
// total wait
$db->query("select count(*) as total from LINKER_WAIT");
$row = $db->nrecord();
$total_wait = $row[total];
// new link
$time = time() - (86400 *7) ;
$db->query("select count(*) as total from LINKER_LINK where uptime > $time");
$row = $db->nrecord();
$new_link = $row[total];
// pick link
$db->query("select count(*) as total from LINKER_LINK where c_pick='1'");
$row = $db->nrecord();
$pick_link = $row[total];
// cool link
$db->query("select count(*) as total from LINKER_LINK where count >= $Scool_num ");
$row = $db->nrecord();
$cool_link = $row[total];
// vote average
$db->query("select sum(n1) as t1, sum(n2) as t2,sum(n3) as t3,sum(n4) as t4,sum(n5) as t5,
sum(n6) as t6,sum(n7) as t7,sum(n8) as t8,sum(n9) as t9,sum(n10) as t10 from LINKER_LINK");
$row = $db->nrecord();
for ($a=1; $a<=10 ;$a++)
$total_vote += $row["t".$a];
if ($total_vote>0) {
$db->query("select sum(n1*1) as t1, sum(n2*2) as t2,sum(n3*3) as t3,sum(n4*4) as t4,sum(n5*5) as t5,
sum(n6*6) as t6,sum(n7*7) as t7,sum(n8*8) as t8,sum(n9*9) as t9,sum(n10*10) as t10 from LINKER_LINK");
$row = $db->nrecord();
for ($b=1; $b<=10 ;$b++)
$vote_total_score += $row["t".$b];
$total_vote_ave = number_format($vote_total_score /$total_vote,2);
}
else $total_vote_ave = "0.00";
// total count
$db->query("select sum(count) as total from LINKER_LINK ");
$row = $db->nrecord();
$total_count = $row[total];
// total visit
$db->query("select sum(visit) as total from LINKER_LINK ");
$row = $db->nrecord();
$total_visit = $row[total];
// search keyword
$db->query("select count(*) as total from LINKER_TWORD");
$row = $db->nrecord();
$search_keyowrd = $row[total];
// main view
$db->query("select count from LINKER_CAT where sid='0'");
$row = $db->nrecord();
$main_view = $row[count];
// total view
$db->query("select sum(count) as total from LINKER_CAT");
$row = $db->nrecord();
$total_view = $row[total];
// $top keyword
$db->query("select count(kword) as count,kword from LINKER_TWORD
group by kword order by count desc,kword limit 3");
while ($row = $db->nrecord()) {
$i++;
${"tkword" . $i} = $row[kword];
}
//=====================================
// Print result
//=====================================
print <<<EOF
<html>
<head>
<title>Linker Data Status</title>
<LINK rel='stylesheet' type='text/css' href='./linker.css'>
<meta http-equiv='Content-Type' content='text/html; charset=$Scharset'>
</head>
<body bgcolor="#E9E9E9">
<table width="500" border="1"><tr><td bgcolor="#000066" align="center" height=25>
<b><font color="white" size="2">$l_right_head</font></b>
</td></tr></table>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="500" bgcolor="#999999">
<tr><td>
<table border="0" cellpadding="0" cellspacing="1" width=100%>
<tr>
<td height="23" bgcolor="#E0E0E0" colspan="2" align=center><b><font size="2">Linker Data Status</font></b> </td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_total $l_cat</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $total_category</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_total $l_link</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $total_link</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_total $l_comment</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $total_comment</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_wait_link</font></td>
<td width="357" height="23" bgcolor="white"> <font size="2">$total_wait</font></td>
</tr>
<tr>
<td height="23" bgcolor="#E0E0E0" colspan="2" align=center><b><font size="2">Link Status</font></b> </td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_new</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $new_link</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_pick</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $pick_link</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_cool</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $cool_link</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_total $l_vote_num</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $total_vote</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_total $l_vote_ave</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $total_vote_ave</font></td>
</tr>
<tr>
<td height="23" bgcolor="#E0E0E0" colspan="2" align=center><b><font size="2">View Status</font></b> </td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_main_view</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $main_view</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_total_view</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $total_view</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_total $l_link $l_count</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $total_count</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_total $l_link $l_visit</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $total_visit</font></td>
</tr>
<tr>
<td height="23" bgcolor="#E0E0E0" colspan="2" align=center><b><font size="2">Search Keyword</font></b> </td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_search_kword</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $search_keyowrd</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_tkword 1</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $tkword1</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_tkword 2</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $tkword2</font></td>
</tr>
<tr>
<td width="138" height="23" bgcolor="#F6F6F6"><font size="2"> $l_tkword 3</font></td>
<td width="357" height="23" bgcolor="white"><font size="2"> $tkword3</font></td>
</tr>
</table>
</td></tr></table>
</body></html>
EOF;
?>