Файл: RootPanel 1.7.0 FreeCode/RootPanel 1.7.0 FreeCode/_rootadmin/_clients.inc.php
Строк: 155
<?
if ($sub == 'delete' and $uid) {
checkAdminAccess('clientsDelete',1);
$user = GetUserById($uid);
$orders = @mysql_query("select * from orders where uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($order = mysql_fetch_object($orders)) {
if ($order->serverlogin) {
$tarif = GetTarifById($order->tarif);
if ($tarif->autodelete) {
if (deleteUser($order->id)) {
print "Аккаунт <b>$order->serverlogin</b> автоматически удален на сервере.<BR>";
} else {
print "Аккаунт <b>$order->serverlogin</b> не удален на сервере ($GLOBALerror).<BR>";
}
} else {
print "Аккаунт <b>$order->serverlogin</b> не удалён на сервере (эта возможность отключена для тарифного плана).<BR>";
}
} else {
print "Аккаунт для заказа <B>ID #$order->id ($order->domain)</b> не был удалён на сервере (не указан логин на сервере или не выбран сервер для заказа).<BR>";
}
@mysql_query("update servers_ips set order_id='0',isMain='0' where order_id='$order->id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
@mysql_query("delete from bills where uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from catalog where uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from mail_logs where uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from orders where uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from orders_domains where uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from specialcosts where uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from users where id='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from users_profile where uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from users_logs where uid='$uid'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$tickets = @mysql_query("select * from tickets where userid='$uid' and parentid='0'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
while ($ticket = @mysql_fetch_object($tickets)) {
@mysql_query("delete from tickets where id='$ticket->id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
@mysql_query("delete from tickets where parentid='$ticket->id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
writeAdminLog("Удален клиент ID # $uid, $user->login");
print "Клиент, а так же все его заказы и счета успешно удалены.<BR><BR>";
}
checkAdminAccess('clientsRead',1);
if ($search) {
if ($param == 'u.id') { $where = "and $param = '$search'"; } else { $where = "and $param LIKE '%$search%'"; }
}
$r = @mysql_query("select u.*,p.surname,p.name,p.otchestvo,p.org,p.firma,p.country from users as u, users_profile as p where u.id=p.uid and u.defaultProfileId=p.id $where order by u.id desc") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$rows = mysql_num_rows($r);
list($start, $perPage, $txt) = MakePages($page, $rows);
getfont();
?>
<table>
<tr><th align=center><h4>Поиск</h4></th></tr>
<tr><td bgcolor=<?=$font_row?>><form method=post><select name=param><option value=u.id>ID:</option><option value=u.login selected>Логин:</option><option value=u.email>E-Mail:</option><option value=p.surname>Фамилия:</option></select> <input type=text name=search size=20> <input type=submit value=Найти></form></td></tr>
</table><br>
<table cellpadding=3 width=99%>
<tr><td colspan=7 align=right><?=$txt?></td></tr>
<tr><th colspan=7 align=center><h4>Клиенты</h4></th></tr>
<tr><th>Опции</th><th align=center>ID</th><th align=center>Логин</th><th align=center>E-mail</th><th align=center>Клиент</th><th align=center>Зарегистрирован</th><th align=center>Опции</th></tr>
<?
$r = @mysql_query("select u.*,p.surname,p.name,p.otchestvo,p.org,p.firma,p.country from users as u, users_profile as p where u.id=p.uid and u.defaultProfileId=p.id $where order by u.id desc LIMIT $start,$perPage") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
$cnt=0;
while ($rr = mysql_fetch_object($r)) {
getfont();getfont();
$orders=mysql_query("select * from orders where uid = $rr->id");
$orders=mysql_num_rows($orders);
$domains=mysql_query("select * from orders_domains where uid = $rr->id and host_id = '0'");
$domains=mysql_num_rows($domains);
$bills=mysql_query("select * from bills where uid = $rr->id");
$bills=mysql_num_rows($bills);
if ($rr->org == "3" and $rr->country) {
$namePrint = "$rr->firma<BR><font color=#CECECE>[организация]</font>";
} else if ($rr->org == "2" and $rr->country) {
$namePrint = "$rr->surname $rr->name $rr->otchestvo<BR><font color=#CECECE>[частный предприниматель]</font>";
} else if ($rr->org == "1" and $rr->country) {
$namePrint = "$rr->surname $rr->name $rr->otchestvo<BR><font color=#CECECE>[физическое лицо]</font>";
} else {
$namePrint = "";
}
$emailPrint = "<a href=?do=mailsend&userid=$rr->id>$rr->email</a>";
if ($rr->email2) { $emailPrint = $emailPrint."<BR><a href=?do=mailsend&userid=$rr->id&alt=1>$rr->email2</a>"; }
print "
<tr bgcolor=$font_row>
<td align=center><a href=?do=profile&id=$rr->id><img src=./_rootimages/profile.gif border=0 alt='Профайл' title='Редактировать профайл'></a><a href=?do=$do&sub=delete&uid=$rr->id onclick="javascript: return confirm('Будет удален клиент, а так же все заказы и счета, относящиесу к нему. Вы уверены, что хотите удалить клиента?');"><img src=./_rootimages/del.gif border=0 alt='Удалить клиента' title='Удалить клиента'></a></td>
<td align=center>$rr->id</td>
<td><A href=?do=fullinfo&id=$rr->id>$rr->login</a></td>
<td>$emailPrint</td>
<td>$namePrint</td>
<td align=center>".mydate($rr->datareg)."</td>
<td align=center><a href=?do=bills¶m=uid&search=$rr->id><img src=./_rootimages/bills.gif alt='Счета: $bills' title='Счета: $bills' border=0></a><a href=?do=orders¶m=uid&search=$rr->id><img src=./_rootimages/orders.gif border=0 alt='Заказы: $orders' title='Заказы: $orders'></a><a href=?do=domains¶m=uid&search=$rr->id><img src=./_rootimages/domain.gif border=0 alt='Домены: $domains' title='Домены: $domains'></a> <a href=?do=history&uid=$rr->id><img src=./_rootimages/history.gif border=0 alt='История' title='История'></a> <a href=?do=gotobilling&id=$rr->id target=_blank><img src=./_rootimages/goto.gif border=0 alt='Войти в биллинг клиента' title='Войти в биллинг клиента'></a></td>
</tr>";
$cnt++;
}
?>
<tr><th colspan=7>Всего клиентов: <?=$rows?>, клиентов на странице: <?=$cnt?></th></tr>
<tr><td colspan=7 align=right><?=$txt?></td></tr>
</table>
<?
?>