SimplePortal

Support => International Support => Turkish (Türkçe) => Topic started by: Paragaya on February 28, 2009, 02:10:52 AM

Title: Top 10 Online Üye
Post by: Paragaya on February 28, 2009, 02:10:52 AM
Arkada?lar böyle bir kod gördüm ama bir türlü ç?kt?s?n? alamad?m en çok zamana göre üyeleri s?ral?yor


Code: [Select]
// Time online top 10.
// !!!SLOW This query is sorta slow.  Should we just add a key? (or would that be bad in the long run?)
$temp = cache_get_data('stats_total_time_members', 600);
$members_result = db_query("
SELECT ID_MEMBER, realName, totalTimeLoggedIn
FROM {$db_prefix}members" . (!empty($temp) ? "
WHERE ID_MEMBER IN (" . implode(', ', $temp) . ")" : '') . "
ORDER BY totalTimeLoggedIn DESC
LIMIT 20", __FILE__, __LINE__);
$context['top_time_online'] = array();
$temp2 = array();
$max_time_online = 1;
while ($row_members = mysql_fetch_assoc($members_result))
{
$temp2[] = (int) $row_members['ID_MEMBER'];
if (count($context['top_time_online']) >= 10)
continue;

// Figure out the days, hours and minutes.
$timeDays = floor($row_members['totalTimeLoggedIn'] / 86400);
$timeHours = floor(($row_members['totalTimeLoggedIn'] % 86400) / 3600);

// Figure out which things to show... (days, hours, minutes, etc.)
$timelogged = '';
if ($timeDays > 0)
$timelogged .= $timeDays . $txt['totalTimeLogged5'];
if ($timeHours > 0)
$timelogged .= $timeHours . $txt['totalTimeLogged6'];
$timelogged .= floor(($row_members['totalTimeLoggedIn'] % 3600) / 60) . $txt['totalTimeLogged7'];

$context['top_time_online'][] = array(
'id' => $row_members['ID_MEMBER'],
'name' => $row_members['realName'],
'time_online' => $timelogged,
'seconds_online' => $row_members['totalTimeLoggedIn'],
'href' => $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'] . '">' . $row_members['realName'] . '</a>'
);

if (!empty($modSettings['MemberColorStats']))
$MemberColor_ID_MEMBER[$row_members['ID_MEMBER']] = $row_members['ID_MEMBER'];

if ($max_time_online < $row_members['totalTimeLoggedIn'])
$max_time_online = $row_members['totalTimeLoggedIn'];
}
mysql_free_result($members_result);

foreach ($context['top_time_online'] as $i => $member)
$context['top_time_online'][$i]['time_percent'] = round(($member['seconds_online'] * 100) / $max_time_online);
Title: Re: Top 10 Online Üye
Post by: [SiNaN] on March 01, 2009, 12:25:31 PM
Stats.template.php'de bunlar? sayfaya yazd?ran kodlar? bunun alt?na eklemelisiniz.

Ama bu kodlar?n sisteminizi biraz yoraca??n? söylemeliyim, kolay bir sorgu de?il.
Title: Re: Top 10 Online Üye
Post by: Paragaya on March 02, 2009, 03:43:29 AM
Hmm o zamn en iyisi bulmamak :) çözüldü zaten...
SimplePortal 2.3.8 © 2008-2024, SimplePortal