Файл: modules/padmin/add_link.php
Строк: 99
<?php
if($user['level'] < 6 || !isset($user)) { header('Location: /'); exit;}
$locate = 'in_padmin';
if(isset($_GET['act']) && $_GET['act'] == 'add') {
$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;
}
if($link_type == 1 && !empty($link_url) && !empty($link_name)) {
$db->query("INSERT INTO `ads` SET `link` = '$link_url', `name` = '$link_name', `type` = '1', `redirect` = '$link_redirect'");
header('location: /padmin/ads/?type=header');
// print_r($db->errorInfo());
} elseif($link_type == 2 && !empty($link_url) && !empty($link_name)) {
$db->query("INSERT INTO `ads` SET `link` = '$link_url', `name` = '$link_name', `type` = '2', `redirect` = '$link_redirect'");
header('location: /padmin/ads/?type=footer');
// print_r($db->errorInfo());
} else {
header('location: /padmin/ads/add?act=error');
}
exit;
}
$title = $lang->word('add_link');
require_once(SYS.'/view/header.php');
$tpl->div('title', $lang->word('add_link'));
if(isset($_GET['act']) && $_GET['act'] == 'error') {
$tpl->div('error', 'Не поддерживается ввод данных');
}
echo '<div class="menu">
<form action="/padmin/ads/add?act=add" method="post">
'. $lang->word('link_url') .':<br/>
<input type="text" name="link_url" /><br/>
'. $lang->word('link_name') .':<br/>
<input type="text" name="link_name" /><br/>
'. $lang->word('link_type') .':<br/>
<select name="link_type">
<option value="1">'. $lang->word('padmin_ads_header') .'</option>
<option value="2">'. $lang->word('padmin_ads_footer') .'</option>
</select><br/>
'. $lang->word('link_redirect') .': <input type="checkbox" name="link_redirect" /><br/>
<input type="submit" value="'. $lang->word('add_link') .'" />
</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');
?>