Просмотр файла wapbuilder/admin/editlink.php

Размер файла: 2.06Kb
<?php
require_once('includes/db.php');
require_once('includes/config.php');
require_once('includes/auth.php');

if(isset($_POST['cancel']))
{
   header('Location: links.php');
   exit;
}

$error = '';
$message = '';
if(isset($_POST['edit']))
{
   if($_POST['name'] != '')
   {
      mysql_query('UPDATE advertising_links SET name = "' . $_POST['name'] . '", url = "' . $_POST['url'] . '" WHERE id = "' . $_POST['id'] . '"');
      $message = SECTION_WAS_SUCCESSFULLY;
      header('Location: links.php');
      exit;
   }
   else
   {
      $error = EMPTY_NAME_FIELD;
   }
}
require_once('includes/header.php');
?>

<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">
        <?php echo EDIT_SECTION; ?>
      </font></td>
</tr></table><br>

<div align="center">
<font class="succ">
<?php echo $message; ?>
</font><br>
</div>

<div align="center">
<font class="error">
<?php echo $error; ?>
</font><br>
</div>

<?php

$categories = mysql_query('SELECT id, name, url FROM advertising_links WHERE id = "' . $_GET['id'] . '"');
$i = 1;
$category = mysql_fetch_array($categories, MYSQL_ASSOC);
?>

<br>

<table align="center" width="99%" border="0" cellspacing="1" cellpadding="3">
<form action="" method="post">


<tr class="addbg"><td width="20%">
Название:
</td><td width="80%">
<input type="text" name="name" value="<?php echo $category['name']; ?>" style="width:100%;">
</td>
</tr>

<tr><td>
URL:
</td><td>
<input type="text" name="url" value="<?php echo $category['url']; ?>" style="width:100%;">
</td>
</tr>

<tr><td colspan="2" align="center">
<br>
<input type="hidden" name="id" value="<?php echo $category['id']; ?>">
<input type="hidden" value="" name="pg">
<input type="submit" name="edit" value="<?php echo EDIT; ?>">
<input type="submit" name="cancel" value="<?php echo CANCEL; ?>">
</td></tr>


</form>

</table>


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