|
Tu masz ostatnio zarejestrowani i najnowsze newsy dołącz sobie jeszcze co chcesz i będziesz miał co chcesz.
$user_and_news_array = array();
openside("");
$result = dbquery("SELECT news_id, news_subject, news_datestamp FROM ".DB_NEWS." WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().") AND news_draft='0'
ORDER BY news_sticky DESC, news_datestamp DESC LIMIT 5");
if(dbrows($result) > 0){
while($data = dbarray($result)){
$user_and_news_array[] = array('id' => $data['news_id'], 'name' => $data['news_subject'], 'datestamp' => $data['news_datestamp'], 'query_id' => 'N');
}
}
$result = dbquery("SELECT user_id, user_name, user_joined FROM ".DB_USERS." ORDER BY user_joined DESC LIMIT 5");
if(dbrows($result) > 0){
while($data = dbarray($result)){
$user_and_news_array[] = array('id' => $data['user_id'], 'name' => $data['user_name'], 'datestamp' => $data['user_joined'], 'query_id' => 'U');
}
}
if(count($user_and_news_array)){
foreach ($user_and_news_array as $key => $row) {
$datestamp[$key] = $row['datestamp'];
}
array_multisort($datestamp, SORT_DESC, $user_and_news_array);
echo "<table border='0' width='100%' class='small'>";
foreach($user_and_news_array AS $data){
if($data['query_id'] == 'U') {
$url = "Najnowszy użytkownik <a href='".BASEDIR."profile.php?lookup=".$data['id']."'>".$data['name']."</a> zarejestrował się ";
} else {
$url = "<a href='".BASEDIR."news.php?readmore=".$data['id']."'>".$data['name']."</a>";
}
echo "<tr>
<td class='small'>".THEME_BULLET." ".$url."</td>
<td align='right' class='small'>".date("d-m-Y H:i",$data['datestamp'])."</td>
</tr>";
}
echo "</table>";
}
closeside();
Kliknij i zaczekaj na załadowanie kodu ... |