View file nkat/admpan.php

File size: 10.14Kb
<?
header("Cache-Control: no-cache");
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
$password = "111";
@include "xconf.php";
if (empty($p)){
print"<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">
<wml><head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>
<card id=\"catalog\" title=\"Админка\">
	<p>";
	
print "
B&#x0432;e&#x0434;&#x0438;&#x0442;e &#x043F;apo&#x043B;&#x044C; a&#x0434;&#x043C;&#x0438;&#x043D;&#x0438;c&#x0442;pa&#x0442;opa:<br/><input type=\"text\" name=\"pass\" maxlength=\"20\"/>
<anchor>
<go href=\"admpan.php?p=$p\" method=\"post\">
<postfield name=\"p\" value=\"$(p)\"/>
</go><br/>Ok</anchor></p></card></wml>";
die();
}
print"<?xml version=\"1.0\" encoding=\"utf-8\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">
<wml><head><meta http-equiv=\"Cache-Control\" content=\"no-cache\" forua=\"true\"/></head>
<card id=\"catalog\" title=\"Админка\">";
if ($p <> $password){
	print "<p>He&#x0432;ep&#x043D;&#x044B;&#x0439; &#x043F;apo&#x043B;&#x044C;</p></card></wml>";
	exit;}
print "<p align=\"left\">";

if($act=="upd"){
print"
<small>Новое название категории:</small><br/>
<input name=\"update\"/><br/>
<small>Расположение:</small> <input name=\"por\" format=\"*N\" size=\"5\" maxlength=\"5\"/><br/>
<small><anchor title=\"go\">[Изменить]<go href=\"admpan.php\" method=\"post\">
<postfield name=\"update\" value=\"$(update)\"/>
<postfield name=\"por\" value=\"$(por)\"/>
<postfield name=\"id\" value=\"$id\"/>
<postfield name=\"p\" value=\"$p\"/>
</go></anchor></small><br/><br/>";}
elseif(isset($c)){
if(empty($page)){$page=0;}
$query=mysql_query("SELECT id FROM `cool_site` where category='$c';");
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$total_pages=ceil($total_mat_number/$mat_per_page);
$prints = mysql_query("select * from `cool_site` where category='$c' order by counter desc limit ".$page.",".($page+$mat_per_page).";");
while($data=mysql_fetch_array($prints)){
print "<small><b>".$data['title']."</b>  id=".$data['id']."<br/>";
print $data['about']."<br/>";
print "<small><u>Из каталога:</u> ".$data['outcounter']."<br/>";
print "<u>В каталог:</u> ".$data['counter']."</small><br/>";
print "<a href=\"out.php?go=".$data['link']."\">".$data['link']."</a><br/><small>(";
if($data['activ']==0){print "<a href=\"admpan.php?p=$p&amp;act=activ&amp;id=".$data['id']."\">Актив.</a> | ";}else{
print "<a href=\"admpan.php?p=$p&amp;act=deactiv&amp;id=".$data['id']."\">Выкл.</a> | ";}
print "<a href=\"admpan.php?p=$p&amp;act=updsite&amp;id=".$data['id']."\">Измен.</a> | ";
print "<a href=\"admpan.php?p=$p&amp;act=delete&amp;id=".$data['id']."\">Удал.</a>)</small></small><br/><br/>";}
print "<small>";
for ($i=0; $i<$total_pages; $i++){
$page_number=$i*$mat_per_page;
if($page_number!=$page){print "<a href=\"admpan.php?p=$p&amp;c=$c&amp;page=$page_number\">[".($i+1)."]</a>";}else{
print "[".($i+1)."]";}}
print "<br/><br/><a href=\"admpan.php?p=$p\">Назад</a></small><br/>";}
elseif($act=="setting"){
print"<small>Название категории:</small><br/>
<input name=\"text\"/><br/>
<small>Расположение:</small> <input name=\"por\" format=\"*N\" size=\"5\" maxlength=\"5\"/><br/>
<small><anchor title=\"go\">[Добавить]<go href=\"admpan.php\" method=\"post\">
<postfield name=\"text\" value=\"$(text)\"/>
<postfield name=\"por\" value=\"$(por)\"/>
<postfield name=\"p\" value=\"$p\"/>
</go></anchor></small><br/>
<small>----------<br/>
Кол. сайтов на стр.:</small> <input name=\"nastr\" format=\"*N\" size=\"3\" maxlength=\"3\"/><br/>
<small><anchor title=\"go\">[Изменить]<go href=\"admpan.php\" method=\"post\">
<postfield name=\"nastr\" value=\"$(nastr)\"/>
<postfield name=\"p\" value=\"$p\"/>
</go></anchor></small><br/>
<small>----------<br/>
Своб. добавл.:</small> <select name=\"onoff\">
<option value=\"0\">нет</option>
<option value=\"1\">да</option>
</select><br/>
<small><anchor title=\"go\">[Изменить]<go href=\"admpan.php\" method=\"post\">
<postfield name=\"onoff\" value=\"$(onoff)\"/>
<postfield name=\"p\" value=\"$p\"/>
</go></anchor></small><br/>
<small>----------<br/>
Отобр. только актив. сайты:</small> <select name=\"activsit\">
<option value=\"0\">нет</option>
<option value=\"1\">да</option>
</select><br/>
<small><anchor title=\"go\">[Изменить]<go href=\"admpan.php\" method=\"post\">
<postfield name=\"activsit\" value=\"$(activsit)\"/>
<postfield name=\"p\" value=\"$p\"/>
</go></anchor><br/><br/>
<a href=\"admpan.php?p=$p\">Назад</a></small><br/>";
}elseif($act=="addsite"){
print"<small>Название сайта:</small> <input type=\"text\" name=\"title\" maxlength=\"50\"/><br/>
<small>URL:</small> <input type=\"text\" name=\"link\" maxlength=\"100\" value=\"http://\"/><br/>";
print"<small>Раздел:</small> <select name=\"k\">";
$q=mysql_query("select * from `cool_raz` where 1 order by por asc");
while($data = @mysql_fetch_array($q)){
print"<option value=\"".$data['id']."\">".$data['text']."</option>";}
print"</select><br/>
<small>Описание:</small> <input type=\"text\" name=\"about\" maxlength=\"300\"/><br/>
<small><anchor>[Добавить]
<go href=\"admpan.php\" method=\"post\">
<postfield name=\"title\" value=\"$(title)\"/>
<postfield name=\"link\" value=\"$(link)\"/>
<postfield name=\"about\" value=\"$(about)\"/>
<postfield name=\"k\" value=\"$(k)\"/>
<postfield name=\"act\" value=\"addsit\"/>
<postfield name=\"p\" value=\"$p\"/>
</go></anchor><br/><br/>
<a href=\"admpan.php?p=$p\">Назад</a></small><br/>";
}elseif($act=="updsite"){
$q = mysql_query("select * from `cool_site` where  id='$id';");
$data = mysql_fetch_array($q);
print"<small>Название сайта:</small><br/>
<input type=\"text\" name=\"title\" maxlength=\"30\" value=\"".$data['title']."\"/><br/>
<small>URL:</small><br/>
<input type=\"text\" name=\"link\" maxlength=\"100\" value=\"".$data['link']."\"/><br/>";
print"<small>Категория:</small> <select name=\"k\" value=\"".$data['category']."\">";
$q=mysql_query("select * from `cool_raz` where 1 order by por asc");
while($datas = @mysql_fetch_array($q)){
print"<option value=\"".$datas['id']."\">".$datas['text']."</option>";}
print"</select><br/>
<small>Описание:</small><br/>
<input type=\"text\" name=\"about\" maxlength=\"300\" value=\"".$data['about']."\"/><br/>
<small><anchor>[Изменить]
<go href=\"admpan.php?act=edit\" method=\"post\">
<postfield name=\"id\" value=\"$id\"/>
<postfield name=\"title\" value=\"$(title)\"/>
<postfield name=\"link\" value=\"$(link)\"/>
<postfield name=\"about\" value=\"$(about)\"/>
<postfield name=\"k\" value=\"$(k)\"/>
<postfield name=\"act\" value=\"updsit\"/>
<postfield name=\"p\" value=\"$p\"/>
</go></anchor></small><br/>";
}else{
if(!empty($text)){
if(mysql_query("insert into `cool_raz` values(0, '$por', '$text')")){print "<u>Категория добавлена!</u><br/><br/>";}}
if(!empty($update)){
mysql_query("update `cool_raz` set text='$update', por='$por' where id='$id'");print "<u>Категория успешно изменена!</u><br/><br/>";}
if($act=="del"){
mysql_query("delete from `cool_raz` where id='$id'");print "<u>Категория удалена!</u><br/><br/>";}
if($act=="delete"){
mysql_query("delete from `cool_site` where id='$id'");print "<u>Сайт удален!</u><br/><br/>";}
if($act=="activ"){
mysql_query("update `cool_site` set activ='1' where id='$id'");print "<u>Сайт активирован!</u><br/><br/>";}
if($act=="deactiv"){
mysql_query("update `cool_site` set activ='0' where id='$id'");print "<u>Сайт выключен!</u><br/><br/>";}
if(isset($nastr)){mysql_query("update `cool_nastr` set kol='$nastr'");print "<u>Кол. сайтов на стр. изменено на $nastr!</u><br/><br/>";}
if(isset($onoff)){mysql_query("update `cool_nastr` set onoff='$onoff'");print "<u>Свободное добавление изменено!</u><br/><br/>";}
if(isset($activsit)){mysql_query("update `cool_nastr` set activsit='$activsit'");print "<u>Отобр. только актив. сайты изменено!</u><br/><br/>";}
if($act=="addsit"){
$title=coding_cool(substr(trim($title), 0, 50));
$link=coding_cool(substr(trim($link), 0, 100));
$about=coding_cool(substr(trim($about), 0, 300));
$k=intval($k);
$q=mysql_query("select onoff from cool_nastr");
$onoff=mysql_result($q,"onoff");
mysql_query("insert into `cool_site` values(0,'$title','$link','','$mailadmin','$about',0,'".time()."','$k','0','$onoff');");
print "<u>Сайт $title успешно добавлен в каталог!</u><br/><br/>";}
if($act=="updsit"){
$id=intval($id);
$title=coding_cool(substr(trim($title), 0, 50));
$link=coding_cool(substr(trim($link), 0, 100));
$about=coding_cool(substr(trim($about), 0, 300));
$k=intval($k);
$q=mysql_query("select onoff from cool_nastr");
$onoff=mysql_result($q,"onoff");
mysql_query("update `cool_site` set title='$title',link='$link',about='$about',category='$k' where id='$id';");
print "<u>Сайт $title успешно изменён!</u><br/><br/>";}
$q=mysql_query("select * from `cool_raz` where 1 order by por asc");
while($data = @mysql_fetch_array($q)){
$catid=$data['id'];
$qs=@mysql_query("select count(*) from `cool_site` where category='$catid';");
$i=@mysql_fetch_array($qs);
print "<small><a href=\"admpan.php?p=$p&amp;c=$catid\">".$data['text']."</a> (".$i['count(*)'].")<br/>";
print " <small>(<a href=\"admpan.php?p=$p&amp;act=upd&amp;id=$catid\">Измен.</a> | <a href=\"admpan.php?p=$p&amp;act=del&amp;id=$catid\">Удал.</a>)</small></small><br/><br/>";
unset($catid);unset($qs);unset($i);}
print"<small><a href=\"admpan.php?p=$p&amp;act=addsite\">Добавить сайт</a><br/>
<a href=\"admpan.php?p=$p&amp;act=setting\">Настройки</a></small><br/>";}

print"<br/><small><a href=\"./\">Каталог</a><br/>
</small></p></card></wml>";
?>