Файл: public_html/my_admin/inc/mode.browse.php
Строк: 29
<?php
#by FeST
#ICQ : 3452223
#Действия с таблицами
$table=chek($_GET['table']);
$order=isset($_GET['order']) ? chek($_GET['order']) : NULL;
$ord=isset($_GET['ord']) ? chek($_GET['ord']) : NULL;
if($order!=NULL)$order_q="ORDER BY `".$order."` ".$ord;else $order_q=NULL;
if(isset($_POST['go'])){
$page=($_POST['start']*10)-10;
header("Location:index.php?table=".$table."&mode=browse&start=".$page.($order!=NULL ? "&order=".$order : "").''.($ord!=NULL ? "&ord=".$ord : ""));
exit;
}
$query="SHOW FULL FIELDS FROM ".$table."";
$arr = mysql_query($query);
if(!$arr) echo "Произошла ошибка: ".mysql_error();
if(mysql_num_rows($arr))
{
$for_count=mysql_num_rows($arr);
echo "Таблица "<a href='index.php?table=".$table."&mode=show'><b>".$table."</b></a>"->Обзор
<table width='100%' border='1'><tr align='center'><td></td>";
while($q=mysql_fetch_array($arr))
echo "<td><b><a href='index.php?table=".$table."&mode=browse&order=".$q[0]."&ord=ASC'>".$q[0]."</a>
".($ord!='ASC' ? "<a href='index.php?table=".$table."&mode=browse&order=".$q[0]."&ord=ASC'><img src='i/asc.png' /></a>" : "<a href='index.php?table=".$table."&mode=browse&order=".$q[0]."&ord=DESC'><img src='i/desc.png' /></a>")."</b></td>";
echo "</tr>";
$total=mysql_result(mysql_query("SELECT COUNT(*) FROM `".$table."`"),0);
if($total>0){
$quert=mysql_query("SELECT * FROM `".$table."` ".$order_q." LIMIT ".$start.",10");
$get=0+$start;
while($arr=mysql_fetch_array($quert)){
echo "<tr class='".($get%2 ? "tr1" : "tr2")."' align='center'>
<td>
<a href='index.php?table=".$table."&mode=edit&col=".($ord!='DESC' ? $get : $total-$get-1)."'><img src='i/edit.png' /></a><a href='index.php?table=".$table."&mode=edit&col=".($ord!='DESC' ? $get : $total-$get-1)."&del'><img src='i/delete.png' /></a></td>";
for($i=0;$i<$for_count;$i++)
echo "<td>".chek(mb_substr($arr[$i],0,100,'UTF-8'))."</td>";
echo "</tr>";
$get++;
}
}
else
echo "Таблица<br/>пуста";
echo "</table>";
if ($total > 10){
echo str_pages('index.php?table='.$table.'&mode=browse&'.($order!=NULL ? "order=".$order."&" : "").''.($ord!=NULL ? "ord=".$ord."&" : ""), $start, $total, 10);
echo '<form method="post" action="index.php?table='.$table.'&mode=browse'.($order!=NULL ? "&order=".$order : "").''.($ord!=NULL ? "&ord=".$ord : "").'">
Стр. <input type="text" name="start" value="'.(($start+10)/10).'" size="2"/>
<input type="submit" name="go" value=">>" />
</form>';}
}
echo "<br/>
« <a href='index.php'>Назад</a>
";
?>