예제 #1
0
function ReCountForum($fid)
{
	global $cfg;
	$sql = "SELECT COUNT(*) FROM $cfg[tb_topics] WHERE fid='$fid'";
	$result = RenDB_Query($sql);
	if($row = RenDB_Fetch_Row($result))
		$topics=$row[0];
	else $topics=0;

	$sql = "SELECT COUNT(*) FROM $cfg[tb_posts] WHERE fid='$fid'";
	$result = RenDB_Query($sql);
	if($row = RenDB_Fetch_Row($result))
		$posts=$row[0];
	else $posts=0;

	$sql = "SELECT author,postdate FROM $cfg[tb_posts] WHERE fid='$fid' ORDER BY pid DESC LIMIT 1";
	$result = RenDB_Query($sql);
	if($row = RenDB_Fetch_Array($result))
	{
		$lastpost=$row['postdate'];
		$lastposter=$row['author'];
	}
	else
	{
		$lastpost=0;
		$lastposter='';
	}

	$sql = "UPDATE $cfg[tb_forums] SET topics='$topics',posts='$posts',lastpost='$lastpost',lastposter='$lastposter'  WHERE  fid='$fid' LIMIT 1";
	RenDB_Query($sql,true);
}
예제 #2
0
function IsMember($name)
{
    global $cfg;
    $sql = "SELECT COUNT(*) FROM {$cfg['tb_members']} WHERE u_name='{$name}' LIMIT 1";
    $result = RenDB_Query($sql);
    if (RenDB_Num_Rows($result) != 0) {
        $row = RenDB_Fetch_Row($result);
        return $row[0];
    }
    return 0;
}
예제 #3
0
 		$my_contacts = explode(',', $_COOKIE['my_contacts']);
 	}
 	else $my_contacts = array();
 	$key = array_search( $sendto, $my_contacts);
 	if( $key!==false ) unset( $my_contacts[$key] );
 	elseif( count($my_contacts) > 6 )array_pop($my_contacts);
 		
 	array_unshift( $my_contacts, $sendto );
 	setcookie( 'my_contacts', implode( ',',$my_contacts), time() + $cfg['cooktime'] );
 	*/
 if (!In_Names($sendto, $cfg['admins'])) {
     //检查消息是否已满
     //	$sql ="SELECT COUNT(*) FROM $cfg[tb_pms] WHERE sendto='$sendto' OR comefrom='$sendto' LIMIT $cfg[maxpm]";
     $sql = "SELECT COUNT(*) FROM {$cfg['tb_pms']} WHERE sendto='{$sendto}' LIMIT {$cfg['maxpm']}";
     $result = RenDB_Query($sql);
     if ($row = RenDB_Fetch_Row($result)) {
         if ($row[0] >= $cfg['maxpm']) {
             SimplyBox('对方消息已经满了');
         }
     }
 }
 //var_dump($meminfo);
 //写入数据库
 $sql = "INSERT INTO `{$cfg['tb_pms']}` SET ";
 $sql .= "sendto='{$sendto}',";
 $sql .= "comefrom='{$udata['u_name']}',";
 $sql .= "sendtime='{$nowtime}',";
 $sql .= "message='{$message}',";
 $sql .= "u_stand='{$pm_stand}'";
 $result = RenDB_Query($sql);
 if ($row = RenDB_Insert_ID()) {
예제 #4
0
 }
 //判断是否结束
 $sql = "SELECT gid FROM `{$cfg['tb_games']}` WHERE group_id='{$gpdata['group_id']}' AND status=0 LIMIT 1";
 $result3 = RenDB_Query($sql);
 if (RenDB_Num_Rows($result3)) {
     $str_status = 'ongoing';
 } else {
     $str_status = 'finished';
 }
 $sql = "SELECT COUNT(*) FROM `{$cfg['tb_games']}` WHERE group_id='{$gpdata['group_id']}'";
 $result3 = RenDB_Query($sql);
 $row = RenDB_Fetch_Row($result3);
 $total = $row[0];
 $sql = "SELECT COUNT(*) FROM `{$cfg['tb_games']}` WHERE group_id='{$gpdata['group_id']}' AND status=0";
 $result3 = RenDB_Query($sql);
 $row = RenDB_Fetch_Row($result3);
 $finished = $total - $row[0];
 $buf .= '<hr width="0" /><table width="100%" border="0"><tr><td>';
 $buf .= '<b>Group ' . chr(65 + $num) . " ({$str_status})</b>";
 $buf .= "</td><td align=\"right\">{$finished}/{$total} finished.[<a href=\"g_search.php?&action=list&group_id={$gpdata['group_id']}\">view</a>] [<a href=\"g_search.php?&action=list&group_id={$gpdata['group_id']}&packdown=1\">download</a>]</td></tr></table>";
 //生成表格
 $buf .= "<table width=\"100%\" border=\"1\" cellspacing=\"0\" cellpadding=\"4\" bordercolor=\"{$color['border']}\">";
 //表头
 $buf .= '<tr align="center"><td width="30">No</td><td>Name</td>';
 foreach ($players as $k => $v) {
     $uid = $k + 1;
     $buf .= "<td>{$uid}</td>";
 }
 $buf .= "<td width=\"30\"><a href=\"group_view.php?group_id={$gpdata['group_id']}&orderby=0\">Pts</a></td>";
 $buf .= "<td width=\"30\"><a href=\"group_view.php?group_id={$gpdata['group_id']}&orderby=1\">Berg</a></td>";
 $buf .= "<td width=\"30\"><a href=\"group_view.php?group_id={$gpdata['group_id']}&orderby=2\">PtsM</a></td>";