<?php
define('MKTOP', 1);
require_once('../system/connect.php');
require_once('../system/core.php');
require_once('../system/function.php');
level(3);
switch($act){
default:
$title = 'İstifadəci idarə etme';
require_once('../head.php');
$count = mysql_num_rows(mysql_query("SELECT * FROM `users`"));
if($count > 0){
echo '<div class="nav">';
if($_GET['sort'] == 'id' OR $_GET['sort'] == null) echo 'ID'; else echo '<a href="users.php?sort=id">ID</a>'; echo ' | ';
if($_GET['sort'] == 'level') echo 'Vezife'; else echo '<a href="users.php?sort=level">Vezife</a>'; echo ' | ';
if($_GET['sort'] == 'time_reg') echo 'Qeydiyyat Tarixi'; else echo '<a href="users.php?sort=time_reg">Qeydiyyat Tarixi</a>';
echo '</div>';
if($_GET['sort'] == 'time_reg') $sort= 'time_reg';
elseif($_GET['sort'] == 'level') $sort= 'level';
else $sort= 'id';
$total=intval(($count-1)/$page_users)+1;
$page=abs(intval($_GET['page']));
if(empty($page) OR $page < 0) $page = 1;
if($page > $total) $page = $total;
$past=intval($count/$page_users);
$start=$page*$page_users-$page_users;
$users = mysql_query("SELECT * FROM `users` ORDER BY `".$sort."` ASC LIMIT ".$start.",".$page_users."");
while($row = mysql_fetch_array($users)){
$start++;
$platforms_c = mysql_num_rows(mysql_query("SELECT * FROM `sait` WHERE `id_user` = '".$row['id']."'"));
echo '<a class="link" href="users.php?act=user&id='.$row['id'].'">'.$start.') '.$row['login'].' <span class="stat">'.$platforms_c.'</span></a>';
}
navigation($count,$page_users,$page,'users.php?sort='.$sort.'&',$total);
}
else{
echo '<div class="text">Istifadeci Movcud Deyil</div>';
echo '<a class="link" href="users.php">İstifadəci idarə etme</a>';
}
break;
case 'user':
$title = 'İstifadəci haqqında məlumat';
require_once('../head.php');
$isset = mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."'");
if(mysql_num_rows($isset) == 0) echo '<div class="text">İstifadəci tapılmadı</div>';
else{
$users = mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1");
$user = mysql_fetch_array($users);
$platforms = mysql_num_rows(mysql_query("SELECT * FROM `sait` WHERE `id_user` = '".$user['id']."'"));
if($user['level'] == 4) $dolzhnost = 'SV!';
else if($user['level'] == 3) $dolzhnost = 'Adm';
else if($user['level'] == 2) $dolzhnost = 'Smd';
else $dolzhnost = 'Users';
echo '<div class="text">ID: '.$user['id'].'</div>';
echo '<div class="text">Login: '.$user['login'].'</div>';
if($id!=1){
echo '<div class="text">Parol: '.$user['password'].'</div>';
}
echo '<div class="text">Email: '.$user['mail'].'</div>';
echo '<div class="text">Vezife: '.$dolzhnost.'</div>';
echo '<div class="text">Qeydiyyat Tarixi: '.data($user['time_reg']).'</div>';
if($id!=1){
echo '<a class="link" href="users.php?act=platforms&id='.$id.'">Saytlar <span class="stat">'.$platforms.'/'.$set['max_platforms'].'</span></a>';
echo '<a class="link" href="users.php?act=edit_user&id='.$id.'">Edit</a>';
echo '<a class="link" href="users.php?act=del_user&id='.$id.'">Sil</a>';
}
}
echo '<a class="link" href="users.php">İstifadəci idarə etme</a>';
break;
////[_X3TA_N!CK_] User Edit 0-dan Yazildi!
case 'edit_user':
$title = 'Saytlari Editle';
require_once('../head.php');
$platform = mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1");
$platform_count = mysql_num_rows($platform);
$user_platform = mysql_fetch_array($platform);
if($platform_count > 0){
if($id!=1){
echo '<form action="users.php?act=edit_user&id='.$id.'" method="post">
<div class="text">Login:<br/><input type="text" class="input" name="login" maxlength="35" value="'.$user_platform['login'].'" /></div>
<div class="text">Parol:<br/><input type="text" class="input" name="password" maxlength="30" value="'.$user_platform['password'].'" /></div>
<div class="text">Rütbe:<br/>';
if ($user_platform['level'] == 4){
echo '<select name="level">';
if(isset($user_data) AND $user_data['level'] >= 4){
echo '<option value="4">SV!</option>';
}
echo '<option value="3">Adm</option>
<option value="2">Smd</option>
<option value="1">İstifadeçi</option>
</select></div>';
}elseif($user_platform['level'] == 3){
echo '<select name="level">
<option value="3">Adm</option>';
if(isset($user_data) AND $user_data['level'] >= 4){
echo '<option value="4">SV!</option>';
}
echo '<option value="2">Smd</option>
<option value="1">İstifadeçi</option>
</select></div>';
}elseif($user_platform['level'] == 2){
echo '<select name="level">
<option value="2">Smd</option>';
if(isset($user_data) AND $user_data['level'] >= 4){
echo '<option value="4">SV!</option>';
}
echo '<option value="3">Adm</option>
<option value="1">İstifadeçi</option>
</select></div>';
}else{
echo '<select name="level">
<option value="1">İstifadeçi</option>
<option value="2">Smd</option>
<option value="3">Adm</option>';
if(isset($user_data) AND $user_data['level'] >= 4){
echo '<option value="4">SV!</option>';
}
echo '</select></div>';
}
echo'<div class="text">Cezalandir:<br/>';
if ($user_platform['status'] == 0){
echo '<select name="status">
<option value="1">Activate Et</option>
<option value="0">Deactive Et</option>
</select></div>';
}else{
echo '<select name="status">
<option value="0">Deactive Et</option>
<option value="1">Activate Et</option>
</select></div>';
}
echo '<div class="text">Balans: (Bal)<br/><input type="text" class="input" name="kr" maxlength="35" value="'.$user_platform['kr'].'" /></div>';
echo '<div class="text"><input name="ok" type="submit" value="Deyiş" /></div></form>';
}
if(!isset($_POST['ok'])) echo $reduser;
else{
$login = filter($_POST['login']);
$password = filter($_POST['password']);
$level = filter($_POST['level']);
$status = filter($_POST['status']);
$kr = filter($_POST['kr']);
$error = '';
if(empty($password) OR empty($login))
$error .= '<div class="text">Butun bolmeleri doldurun</span>';
else{
$platform_isset = mysql_num_rows(mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1"));
if($platform_isset == 0)
$error .= '<div class="error">Bele sayt yoxdur</div>';
if(mb_strlen($login) > 40 OR mb_strlen($login) < 3)
$error .= '<div class="error">Login uzunlugu az 3 və artıq 40 simvoldan cox olmamalıdır</div>';
if(mb_strlen($password) > 40 OR mb_strlen($password) < 6)
$error .= '<div class="error">Parol uzunlugu artıq 40 simvoldan ən azı 6 simvol olmalıdır</div>';
}
if(!empty($error)){
echo $error;
echo $reduser;
}
else{
$edit = mysql_query("UPDATE `users` SET `login` = '".$login."', `password` = '".$password."', `status` = '".$status."', `level` = '".$level."', `kr` = '".$kr."' WHERE `id` = '".$id."'");
if($edit) echo '<div class="link"><b><span style="color:red">'.$user_platform['login'].'</span> İstifadeçi uğurla deyişdirildi!</b></div>';
else echo '<div class="error">İstifadeçi deyişilmedi</div>';
}
}
}
else echo '<div class="error">Bele İstifadeçi movcud deyil</div>';
echo '<a class="link" href="users.php">İstifadeçi idarə etme</a>';
break;
////[_X3TA_N!CK_] User Edit 0-dan Yazildi! SON!
case 'platforms':
$title = 'İstifadəci Saytlar';
require_once('../head.php');
$count = mysql_num_rows(mysql_query("SELECT * FROM `sait` WHERE `id_user` = '".$id."'"));
if($count > 0){
$total=intval(($count-1)/$page_sait)+1;
$page=abs(intval($_GET['page']));
if(empty($page) OR $page < 0) $page = 1;
if($page > $total) $page = $total;
$past=intval($count/$page_sait);
$start=$page*$page_sait-$page_sait;
if($_GET['sort'] == 'hits') $sort= 'hits';
elseif($_GET['sort'] == 'in') $sort= 'in';
elseif($_GET['sort'] == 'out') $sort= 'out';
else $sort= 'hosts';
$saits = mysql_query("SELECT * FROM `sait` WHERE `id_user` = '".$id."' ORDER BY `".$sort."` DESC LIMIT ".$start.",".$page_sait."");
while($row = mysql_fetch_array($saits)){
$start++;
$zabanen = ($row['ban'] == 0) ? '' : '(Ban Edilib)';
$status = $row['status'] == 1 ? '' : '(Tesdiqlenmeyib)';
echo '<a class="link" href="/out/'.$row['id'].'.php">'.$start.') '.$row['name'].' <span class="stat">'.$row['hosts'].'/'.$row['hits'].'</span> '.$zabanen.''.$status.'</a>';
if(mb_strlen($row['about']) > 50){
$text = mb_substr($row['about'], 0, 50, 'utf-8');
echo '<a class="link" href="/infos.php?id='.$row['id'].'">'.$text.'...</a>';
}
else echo '<a class="link" href="/infos.php?id='.$row['id'].'">'.$row['about'].'</a>';
echo '<div class="text"><a href="/adminka/platforms.php?act=edit_sait&id='.$row['id'].'">Deyiş</a> | ';
if($row['ban'] == 1) echo '<a href="/adminka/platforms.php?act=ban&id='.$row['id'].'">Azad Et </a> | ';
else echo '<a href="/adminka/platforms.php?act=ban&id='.$row['id'].'">Ban Et</a> | ';
if($row['status'] == 0) echo ' <a href="/adminka/moderacia.php?act=activate&id='.$row['id'].'">Aktiv Et</a> | ';
echo '<a href="/adminka/platforms.php?act=del_sait&id='.$row['id'].'">Sil</a></div>';
}
navigation($count,$page_sait,$page,'users.php?act=platforms&id='.$id.'&sort='.$sort.'&',$total);
}
else echo '<div class="text">Bu istifadəcinin hec bir əsası yoxdur</div>';
echo '<a class="link" href="users.php?act=user&id='.$id.'">İstifadəci haqqında məlumat</a>';
break;
case 'del_user':
$title = 'Istifadecini Silmek';
require_once('../head.php');
$user_isset = mysql_query("SELECT * FROM `users` WHERE `id` = '".$id."' LIMIT 1");
$user_isset_c = mysql_num_rows($user_isset);
if($user_isset_c > 0){
$user = mysql_fetch_array($user_isset );
if(!isset($_GET['ok'])){
if($id!=1){
echo '<div class="text">Bu "'.$user['login'].'" istifadecini silmekde eminsiniz?</div>';
echo '<a class="link" href="users.php?act=del_user&id='.$id.'&ok">Beli, silirem</a>';
echo '<a class="link" href="users.php">Xeyr, silmirem</a>';
}
}
else{
$platforms = mysql_query("SELECT * FROM `sait` WHERE `id_user` = '".$id."' LIMIT 1");
while($sait = mysql_fetch_array($platforms)){
$del_hosts = mysql_query("DELETE FROM `hosts` WHERE `id_sait` = '".$platforms['id']."'");
$del_hits = mysql_query("DELETE FROM `hits` WHERE `id_sait` = '".$platforms['id']."'");
$del_online = mysql_query("DELETE FROM `sait_online` WHERE `id_sait` = '".$platforms['id']."'");
$del_platform = mysql_query("DELETE FROM `sait` WHERE `id` = '".$platforms['id']."'");
}
$del_user = mysql_query("DELETE FROM `users` WHERE `id` = '".$id."'");
if($del_user) echo '<div class="text">Istifadeci ugurla silindi</div>';
else echo '<div class="text">Istifadeci silinmedi</div>';
}
}
else echo '<div class="text">Bele istifadeci movcud deyil</div>';
echo '<a class="link" href="users.php">İstifadəci idarə etme</a>';
break;
}
if($user_data['level'] == 3) echo '<a class="link" href="index.php">Admin Panel</a>';
require_once('../foot.php');
?>