View file admin/links.php

File size: 2.03Kb
<?php
require_once('includes/db.php');
require_once('includes/config.php');
require_once('includes/auth.php');

require_once('includes/header.php');

if(isset($_POST['delete']))
{
   if(isset($_POST['check']))
   {
      foreach($_POST['check'] as $id => $value)
      {
         if($value == 1)
         {
            mysql_query('DELETE FROM advertising_links WHERE id = "' . $id . '"');
         }
      }
   }
}
?>
<table align="center" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="addbg"><td align="center" background="images/t5.gif"><font color="#FFFFFF"></font>
        <font class="header">
         Ссылки
        </font></td>
</tr></table>

<div align="center">
&nbsp;
</div>

<br>
<table width="99%" align="center" border="0" cellspacing="1" cellpadding="5" class="listtable">
<tr class="tablehead" align="center">
<td><b>ID</td>
<td><b>Название</td>
<td><b>Url</td>
<td colspan="2"><b>Действия</td>
<form action="" method="post">
</tr>

<?php

$categories = mysql_query('SELECT id, name, url FROM `advertising_links`links ORDER BY id');
$i = 1;
while($category = mysql_fetch_array($categories, MYSQL_ASSOC))
{
   $i = ($i == 1) ? 2 : 1;
   echo '
<tr class="bg' . $i . '">
<td align="center">' . $category['id'] . '</td>
<td align="left"><a href="editlink.php?id=' . $category['id'] . '" title="' . EDIT . '">' . $category['name'] . '</a></td>
<td align="left">' . $category['url'] . '</td>
<td align="center"><a href="editlink.php?id=' . $category['id'] . '" title="' . EDIT . '">' . EDIT . '</a></td>
<td align="center"><input type="checkbox" name="check[' . $category['id'] . ']" value="1"></td>
</tr>
';
}

?>

<tr class="tablehead">
<td colspan="3"><input type="button" name="add" value="Добавить ссылку" onclick="javascript:location='addlink.php';"></td>
<td colspan="2" align="right"><input type="submit" name="delete" value="<?php echo DELETE; ?>" onclick="javascript:return Submit();"></td>
</tr>
</form>
</table>

<?php
require_once('includes/footer.php');
?>