Файл: modules/padmin/edit_link.php
Строк: 98
<?php
if($user['level'] < 6 || !isset($user)) { header('Location: /'); exit;}
$locate = 'in_padmin';
if(isset($_GET['link_id'])) {
if(isset($_GET['act']) && $_GET['act'] == 'edit') {
$link_url = input($_POST['link_url']);
$link_name = input($_POST['link_name']);
$link_type = abs(intval($_POST['link_type']));
if(isset($_POST['link_redirect'])) {
$link_redirect = 1;
}
else
{
$link_redirect = 2;
}
$db->query("UPDATE `ads` SET `link` = '$link_url', `name` = '$link_name', `type` = '$link_type', `redirect` = '$link_redirect' WHERE `id` = '". abs(intval($_GET['link_id'])) ."'");
header('location: /padmin/ads/');
// echo $link_type;
exit;
}
$linke = $db->query("SELECT * FROM `ads` WHERE `id` = '". abs(intval($_GET['link_id'])) ."'")->fetch();
$title = $lang->word('edit_link');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('edit_link'));
if(isset($_GET['act']) && $_GET['act'] == 'error') {
$tpl->div('error', 'Unsupported input data');
}
echo '<div class="menu">
<form action="/padmin/ads/edit?act=edit&link_id='.abs(intval($_GET['link_id'])).'" method="post">
'. $lang->word('link_url') .':<br/>
<input type="text" name="link_url" value="'. $linke['link'] .'"/><br/>
'. $lang->word('link_name') .':<br/>
<input type="text" name="link_name" value="'. $linke['name'] .'"/><br/>
'. $lang->word('link_type') .':<br/>
<select name="link_type">
<option value="1" '.($linke['type'] == 1 ? 'selected="selected"' : NULL).'>'. $lang->word('header_link') .'</option>
<option value="2" '.($linke['type'] == 2 ? 'selected="selected"' : NULL).'>'. $lang->word('footer_link') .'</option>
</select><br/>
'. $lang->word('link_redirect') .': <input type="checkbox" name="link_redirect" '.($linke['redirect'] == 1 ? 'checked' : NULL).'/><br/>
<input type="submit" value="'. $lang->word('save') .'" />
</form>
</div>';
$tpl->div('block', img('ads.png') .'<a href="/padmin/ads/">'. $lang->word('padmin_ads') .'</a><br/>'. img('admin.png') .'<a href="/padmin/">'. $lang->word('padmin') .'</a><br/>'. HICO .'<a href="/">'. $lang->word('home') .'</a>');
require_once(SYS.'/view/footer.php');
} else { header('location: /index.php'); exit;}
?>