Файл: masteram_us/shop/admin.php
Строк: 88
<?
require'../shaxty.php'; // waphp.ru - закрытый клуб вап мастеров!
$align='left';
$title='Магазин';
$head='Магазин';
include_once (H.'shaxty/head.php');
check_login();
levels(9);
function retrans($t){
$a = array('_','YA','Ya','ya','yee','YO','yo','Yo','ZH','zh','Zh','Z','z','CH','ch','Ch','SH','sh','Sh','YE','ye','Ye','YU','yu','Yu','JA','ja','Ja','A','a','B','b','V','v','G','g','D','d','E','e','I','i','J','j','K','k','L','l','M','m','N','n','O','o','P','p','R','r','S','s','T','t','U','u','F','f','H','h','W','w','x','q','Y','y','C','c','!');
$b = array(' ','Я','Я','я','ые','Ё','ё','Ё','Ж','ж','Ж','З','з','Ч','ч','Ch','Ш','ш','Ш','Э','э','Э','Ю','ю','Ю','Я','я','Я','А','а','Б','б','В','в','Г','г','Д','д','Е','е','И','и','Й','й','К','к','Л','л','М','м','Н','н','О','о','П','п','Р','р','С','с','Т','т','У','у','Ф','ф','Х','х','Щ','щ','ъ','ь','Ы','ы','Ц','ц','');
return str_replace($b,$a,$t);
}
function del123456789($text)
{
$text=str_replace('&','', $text);
$text=str_replace('$','', $text);
$text=str_replace('>','', $text);
$text=str_replace('<','', $text);
$text=str_replace('~','', $text);
$text=str_replace('`','', $text);
$text=str_replace('#','', $text);
$text=str_replace('*','', $text);
return $text;
}
$mod = check($_GET['mod']);
$act = check($_GET['act']);
$fid = check(intval($_GET['fid']));
switch($mod){
default:
//echo '<a href="?fid='.$fid.'&mod=newdir">Новая папка</a><br />';
break;
case 'addr':
if (empty($act)){
echo '<form action="?mod=addr&id='.$id.'&act=act" method="post">';
echo 'Категория:<br/>';
echo '<input type="text" name="name" title="Категория"/><br/>';
echo 'Положение:<br/>';
echo '<input type="text" name="pos" title="Положение"/><br/>';
echo 'Описание: (не обязательно)<br/>';
echo '<input type="text" name="about" title="Описание"/><br/>';
echo '<input type="checkbox" name="adds" value="1"/> Добавлять в эту папку товар<br/>';
echo '<br /><input type="submit" class="ibutton" value="Добавить"/></form><br /><br />';
}else{
$name = check($_POST['name']);
$pos = check(intval($_POST['pos']));
if ($user['translit']==1)$name = translit($name);
$about = check($_POST['about']);
if ($user['translit']==1)$about = translit($about);
$adds = check((int)$_POST['adds']);
if (strlen2($name)<3)$err = $err.'Короткое имя!<br />';
$name_lat = rus_lat(rus_utf_tolower(del($name)));
if($id!=NULL){
$cat=mysql_fetch_array(mysql_query("select * from shop_files where tip = 'cat' and `id` = '$id';"));
$refid = $cat['id'];
$refer = $cat['refer'].$cat['name_lat']."|";
}else{
$refid = 0;
$refer = "cats|";
}
if (empty($err)){
if (mysql_query ("INSERT INTO shop_files (name,about,pos,time,name_lat,tip,refid,refer,adds) VALUES ('$name','$about','$pos','$time','$name_lat','cat','$refid','$refer','$adds')")){header ('Location: index.php?id='.$refid.''); exit;
}else echo 'Ошибка!<br />';
}else echo $err;
}
break;
case 'editr':
$blog = mysql_fetch_array(mysql_query("select * from `shop_files` where id = '".$id."'" ));
if (empty($act)){
if (isset($_GET['del'])){
mysql_query("DELETE FROM `shop_files` where id = '".$id."'");
mysql_query("DELETE FROM `shop_files` where refid = '".$id."'");
header ('Location: index.php?id='.$blog['refid'].'');
}
echo '<form action="admin.php?mod=editr&id='.$id.'&act=act" method="post">';
echo 'Категория: <b>'.$blog['name'].'</b><br/>';
//echo '<input type="text" name="name" value="'.$blog['name'].'" title="Категория"/><br/>';
echo 'Положение:<br/>';
echo '<input type="text" name="pos" value="'.$blog['pos'].'" title="Положение"/><br/>';
echo 'Описание: (не обязательно)<br/>';
echo '<input type="text" name="about" value="'.$blog['about'].'" title="Описание"/><br/>';
if($blog['adds']==1)echo '<input type="checkbox" name="adds" value="1" checked/> Добавлять в эту папку товар<br/>';
else echo '<input type="checkbox" name="adds" value="1"/> Добавлять в эту папку товар<br/>';
echo '<br /><input type="submit" class="ibutton" value="Изменить"/></form><br />';
echo '<br /><a href="admin.php?mod=editr&id='.$id.'&del">Удалить</a><br />';
}else{
//$name = check($_POST['name']);
$pos = check(intval($_POST['pos']));
//if ($user['translit']==1)$name = translit($name);
$about = check($_POST['about']);
if ($user['translit']==1)$about = translit($about);
$adds = check((int)$_POST['adds']);
//if (strlen2($name)<3)$err = $err.'Короткое имя!<br />';
//$name_lat = rus_lat(rus_utf_tolower(del($name)));
if (empty($err)){
if (mysql_query ("UPDATE `shop_files` SET `about` = '$about', `pos` = '$pos', `adds` = '$adds' where `id`='".$id."' LIMIT 1")){
$cat=mysql_fetch_array(mysql_query("select * from shop_files where tip = 'cat' and `id` = '$id';"));
header ('Location: index.php?id='.$blog['refid'].''); exit;
}else echo 'Ошибка!<br />';
}else echo $err;
}
break;
}
echo "<br/>";
echo $div1.'<a href="/usscripts">Назад</a>'.$div9;
include_once (H.'shaxty/foot.php');
?>