Файл: _rootadmin/_smslogs.inc.php
Строк: 78
<?
if ($sub == "delete" and $id) {
checkAdminAccess('smsLogsDelete',1);
@mysql_query("delete from smsgateways_logs where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
writeAdminLog("Удалено SMS-сообщение ID # $id");
print "SMS-сообщение успешно удалено.<BR><BR>";
$sub = "";
}
if ($sub == "getstatus" and $id) {
$result = getSMSStatus($id);
if ($result) {
@mysql_query("update smsgateways_logs set dt_delivered='$result[date]',status='$result[status]' where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
if ($result[cost]) {
@mysql_query("update smsgateways_logs set cost='$result[cost]' where id='$id'") or die("File: ".__FILE__."<BR>Line: ".__LINE__."<BR>MySQL Error: ".mysql_error());
}
} else {
print "Не удалось получить статус доставки SMS ($GLOBALerror)<BR><BR>";
}
$sub = "";
}
if (!$sub) {
checkAdminAccess('smsLogsRead',1);
$r = @mysql_query("select * from smsgateways_logs order by 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);
?>
<table cellpadding=3 width=99%>
<tr><td colspan=9 align=right><? print $txt?></td></tr>
<tr><td colspan=9 align=center bgcolor=<? print $font_head?>><B>Логи SMS-сообщений</b></td></tr>
<tr bgcolor=<? print $font_head?> align=center><td>ID #</td><td>Шлюз</td><td>Кому</td><td>Дата отправки</td><td>Сообщение</td><td>Статус</td><td>Дата доставки</td><td>Цена</td><td></td></tr>
<?
$r = @mysql_query("select * from smsgateways_logs order by 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();
$cnt++;
$gateway=GetSMSGatewayById($rr->gateway);
$gatewaytype=$gateway->type;
$komu = "<font size=1pt>".$rr->mobile."</font>";
if ($rr->userid) { $user = GetUserById($rr->userid); if ($user->id) { $komu = $komu."<BR><a href=?do=fullinfo&id=$rr->userid target=_blank>$user->login</a>"; }}
else if ($rr->adminid) { $user = GetAdminById($rr->adminid); if ($user->id) { $komu = $komu."<BR><B>$user->name</b>"; }}
if ($rr->cost and ($gateway->type == "epochtasms")) {$cost = $rr->cost." credits";}
else if ($rr->cost and ($gateway->type == "bytehand")) {$cost = $rr->cost." руб.";}
else { $cost = ""; }
if ($rr->dt_delivered != "0000-00-00 00:00:00") { $delivered = $rr->dt_delivered; } else { $delivered = ""; }
$delete="<A href=?do=$do&sub=delete&id=$rr->id onclick="javascript: return confirm('Вы уверены, что хотите удалить SMS-сообщение?');"><img src=./_rootimages/del.gif border=0 alt='Удалить сообщение'></a>";
?>
<tr valign=middle align=center bgcolor="<? print $font_row?>" height=30>
<td><? print $rr->id?></td>
<td><font size=1pt><? print $gatewaytype?></font></td>
<td width=100><? print $komu?></td>
<td><? print $rr->dt?></td>
<td><? print $rr->msg?></td>
<? if ($delivered or $rr->status) { ?>
<? if (!$delivered) { ?>
<td colspan=2><A href=?do=<? print $do?>&sub=getstatus&id=<? print $rr->id?> title="Обновить"><? print $rr->status?></a></td>
<? } else { ?>
<td><? print $rr->status?></td><td><? print $delivered?></td>
<? } ?>
<? } else { ?>
<td colspan=2><A href=?do=<? print $do?>&sub=getstatus&id=<? print $rr->id?>>получить</a></td>
<? } ?>
<td><? print $cost?></td>
<td><? print $delete?></td>
</tr>
<?
}
?>
<tr bgcolor=<? print $font_head?>><Td colspan=9>Всего SMS-сообщений: <? print $rows?>, SMS-сообщений на странице: <? print $cnt?></td></td></tr>
<tr><td colspan=9 align=right><? print $txt?></td></tr>
</table><br><Center>
<?
}
?>