sibtracker/system/modules/users.php

141 lines
8.7 KiB
PHP
Raw Normal View History

2019-05-18 13:46:03 +08:00
<?php
if(!defined('DATALIFEENGINE')){die("Hacking attempt!");}
$limit = 50; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
$order_by = 1;
if( isset( $_REQUEST['action'] ) ) $action = $_REQUEST['action']; else $action = "";
$tpl->load_template('users.tpl');
$tpl->set( '[all]', "<a href=\"/users\">" );
$tpl->set( '[/all]', "</a>" );
$tpl->set( '[last]', "<a href=\"/users/last\">" );
$tpl->set( '[/last]', "</a>" );
$tpl->set( '[banned]', "<a href=\"/users/banned\">" );
$tpl->set( '[/banned]', "</a>" );
switch($action){
case 'last':
$tpl->set_block( "'\\[list_all\\].*?\\[/list_all\\]'si", "" );
$tpl->set_block( "'\\[list_banned\\].*?\\[/list_banned\\]'si", "" );
$tpl->set( '[list_last]', "" );
$tpl->set( '[/list_last]', "" );
$today = mktime(0,0,0,date('m'),date('d'),date('Y'));
$last_num = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE `lastdate` > '$today'" );
$last = $db->query("SELECT * FROM `". PREFIX ."_users` WHERE `lastdate` > '$today' ORDER BY `lastdate`");
$last_list = "<thead><td><3E><><EFBFBD></td><td align=\"center\"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD></td><td align=\"center\"><3E><><EFBFBD><EFBFBD><EFBFBD></td></thead>";
while($row = $db->get_row($last)){
if ($user_group[$row['user_group']]['colour']){
$group_span = $user_group[$row['user_group']]['colour'];
$group_name = "<span style=\"color:{$group_span}\">".$user_group[$row['user_group']]['group_name']."</span>";
}else $group_name = $user_group[$row['user_group']]['group_name'];
$last_list .= "<tr><td><a href=".$config['http_home_url']."user/".urlencode($row['name']).">".$row['name']."</a></td><td align=\"center\">".$group_name."</td><td align=\"center\">". langdate( "H:i:s", $row['lastdate'] )."</td></tr>";
} $db->free();
$tpl->set( '{last_users}', $last_num['count']);
$tpl->set( '{lastusers}', $last_list );
break;
case 'banned':
$tpl->set_block( "'\\[list_all\\].*?\\[/list_all\\]'si", "" );
$tpl->set_block( "'\\[list_last\\].*?\\[/list_last\\]'si", "" );
$tpl->set( '[list_banned]', "" );
$tpl->set( '[/list_banned]', "" );
$banned_num = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE banned='yes'" );
if(!$banned_num['count'] == 0){
$banned = $db->query("SELECT " . USERPREFIX . "_users.*, " . USERPREFIX . "_banned.days, " . USERPREFIX . "_banned.descr, " . USERPREFIX . "_banned.date as banned_date FROM " . USERPREFIX . "_users LEFT JOIN " . USERPREFIX . "_banned ON " . USERPREFIX . "_users.user_id=" . USERPREFIX . "_banned.users_id WHERE banned='yes'");
$banned_list = "<thead><td><3E><><EFBFBD></td><td align=\"center\"><3E><><EFBFBD><EFBFBD></td><td align=\"center\"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD></td><td align=\"center\"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></td></thead>";
while($row = $db->get_row($banned)){
$days = $row['days']; if ($days == 0)$ava = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";else$ava = "".$row['days']." <20><><EFBFBD><EFBFBD>";
$banned_date = $row['banned_date']; if ($banned_date == 0) $dated = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; else $dated = $lang['ban_edate']." ".langdate("j M Y H:i", $row['banned_date']);
$descr = $row['descr']; if ($descr == "") $descru = "<EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; else $descru = "".$row['descr']."";
$banned_list .= "<tr><td><a href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['name'] ) . "/\">" . $row['name']."</a></td><td align=\"center\">".$ava."</td><td align=\"center\">".$dated."</td><td align=\"center\">".$descru."</td></tr>";
}
} else $banned_list = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
$tpl->set( '{banneds}', $banned_list );
$db->free();
break;
default:
if (isset($_POST['uname'])){$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_users WHERE name LIKE '%{$_POST['uname']}%'";
}else $sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_users";
$count_all = $db->super_query($sql_count);
$count_all = $count_all['count'];
$page = intval( $_REQUEST['cstart'] );
$total = intval( ( ( $count_all - 1 ) / $limit ) + 1 );
if( $page <= 0 ) $page = 1;
if( $page > $total ) $page = $total;
$start = $page * $limit - $limit;
$i = $start;
switch($order_by) {case 1: $orderby = 'user_id ASC'; break;case 2: $orderby = 'user_id DESC'; break;case 3: $orderby = 'news_num DESC'; break;case 4: $orderby = 'comm_num DESC'; break;case 5: $orderby = 'name ASC'; break;}
$i = $start;
$result = $db->Query("SELECT * FROM ". USERPREFIX ."_users ORDER BY ".$orderby." LIMIT $start,$limit");
if ($_REQUEST['act'] == 'dosearch') {$result = $db->Query("SELECT * FROM ". USERPREFIX ."_users WHERE name LIKE '".$_POST['uname']."%' ORDER BY user_id ASC LIMIT $start,$limit"); }
if ($_REQUEST['order'] == 'asc'){ $result = $db->Query("SELECT * FROM ". USERPREFIX ."_users ORDER BY user_id ASC LIMIT $start,$limit");}
elseif($_REQUEST['order'] == 'desc') {$result = $db->Query("SELECT * FROM ". USERPREFIX ."_users ORDER BY user_id DESC LIMIT $start,$limit");}
elseif($_REQUEST['order'] == 'newsnum'){$result = $db->Query("SELECT * FROM ". USERPREFIX ."_users ORDER BY news_num DESC LIMIT $start,$limit");}
elseif($_REQUEST['order'] == 'commnum'){$result = $db->Query("SELECT * FROM ". USERPREFIX ."_users ORDER BY comm_num DESC LIMIT $start,$limit");}
elseif($_REQUEST['order'] == 'az'){$result = $db->Query("SELECT * FROM ". USERPREFIX ."_users ORDER BY name ASC LIMIT $start,$limit");}
elseif($_REQUEST['order'] == 'rand'){$result = $db->Query("SELECT * FROM ". USERPREFIX ."_users ORDER BY rand() DESC LIMIT $start,$limit");}
$tpl->set_block( "'\\[list_last\\].*?\\[/list_last\\]'si", "" );
$tpl->set_block( "'\\[list_banned\\].*?\\[/list_banned\\]'si", "" );
$tpl->set( '[list_all]', "" );
$tpl->set( '[/list_all]', "" );
$all_users = '
<div class="shadow2"><div class="block2">
<center><table><TR>
<TD class="copy"><form name="desc" method="POST"><input type="hidden" name="order" value="desc"><a href="#" onclick="javascript:document.desc.submit();"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a></form></TD>
<Td>&nbsp;&nbsp;|&nbsp;&nbsp;</tD>
<TD class="copy"><form name="asc" method="POST"><input type="hidden" name="order" value="asc"><a href="#" onclick="javascript:document.asc.submit();"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a></form></TD>
<Td>&nbsp;&nbsp;|&nbsp;&nbsp;</tD>
<TD class="copy"><form name="newsnum" method="POST"><input type="hidden" name="order" value="newsnum"><a href="#" onclick="javascript:document.newsnum.submit();"><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a></form></TD>
<Td>&nbsp;&nbsp;|&nbsp;&nbsp;</tD>
<TD class="copy"><form name="commnum" method="POST"><input type="hidden" name="order" value="commnum"><a href="#" onclick="javascript:document.commnum.submit();"><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a></form></TD>
<Td>&nbsp;&nbsp;|&nbsp;&nbsp;</tD>
<TD class="copy"><form name="az" method="POST"><input type="hidden" name="order" value="az"><a href="#" onclick="javascript:document.az.submit();"><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a></form></TD>
<Td>&nbsp;&nbsp;|&nbsp;&nbsp;</tD>
<TD class="copy"><form name="rand" method="POST"><input type="hidden" name="order" value="rand"><a href="#" onclick="javascript:document.rand.submit();"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></a></form></TD>
</TR></table></center>
</div></div>
<div class="shadow2"><div class="block2"><div class="line line_center"><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></div>
<table class="userstop"><tr>
<td width="50"><b><EFBFBD></b></td><td width="100"><b><EFBFBD><EFBFBD><EFBFBD></b></td><td width="100"><b><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></b></td><td width="70"><b>Email</b></td><td width="100"><b>ICQ</b></td><td width="150"><b><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></b></td><td width="80"><b><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></b></td><td width="120"><b><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></b></td>
</tr>';
while ($row = $db->get_row($result)){
$i ++;
$prifile_link = '<a href="'.$config['http_home_url'].'user/'.urlencode($row['name']).'/ ">'.$row['name'].'</a>';
if ($row['icq'] != '') {$icq = $row['icq'];
}else {
$icq = '--';$icq_status = '--';
}
$all_users .= '<tr>
<td width="50"><b>'. $row['user_id'] .'</b></td><td width="100" class="copy">' . $prifile_link .'</td><td width="100">'.stripslashes($user_group[$row['user_group']]['group_name']).'</td><td width="70"><a href="/?do=feedback&user='.$row['user_id'].'"><img src="{THEME}/images/unread.gif" border="0"></a></td><td width="50">'.$icq.'</td><td width="150">'.langdate("j F Y H:i", $row['reg_date']).'</td><td width="80">'.$row['news_num'].'</td><td width="120">'.$row['comm_num'].'</td>
</tr> ';
};
$all_users .= '</table></div></div>';
$tpl->set('{all_users}',$all_users);
break;
}
$tpl->compile('content');
$tpl->clear();
$nav = "/users/page/{page}";
CreateNavigation( $nav, $page, $total );
?>