header('Content-Type: text/html; charset=tis-620'); echo ""; require_once('db_config.php'); $sql="select * from $_std where std_id>1"; $result=mysql_query($sql); while ($db=mysql_fetch_array($result)) { $sql7="select * from $_log,$_std where log_std=std_id and log_std='$db[std_id]' group by date(log_date) "; $result7=mysql_query($sql7); $nlog=mysql_num_rows($result7)*2; $sql8="select * from $_act,$_std where act_std=std_id and act_std='$db[std_id]' and act_type in (1,5) group by act_std,act_type,act_target"; $result8=mysql_query($sql8); $nact=mysql_num_rows($result8)*2; $sql6="select * from $_act,$_std where act_std=std_id and act_std='$db[std_id]' and act_type in (5,7) and act_eval=3 group by act_target"; $result6=mysql_query($sql6); $nfile=mysql_num_rows($result6)*3; $sql5="select * from $_like where lke_std2='$db[std_id]' group by lke_std1,lke_std2"; $result5=mysql_query($sql5); $plike=mysql_num_rows($result5)/3; $sql4="select * from $_act where act_type IN (5,6,7) and act_eval=3 and act_std='$db[std_id]' group by act_target"; $result4=mysql_query($sql4); $score=0; while ($db4=mysql_fetch_array($result4)) { $score+=$db4[act_level]*10; } $power=$nlog+$nact+$nfile+$plike+$score; $sql0="update $_std set std_power='$power' where std_id='$db[std_id]' "; mysql_query($sql0); } $sql1="select * from $_std where std_id>1 order by std_power desc limit 0,10"; $result1=mysql_query($sql1); echo "
$rw.$db1[std_name1] $db1[std_room] $db1[std_power] $nlike | ";
$rw++;
}
echo "