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

Размер файла: 64.73Kb
<?
session_start();
$title="Админка\n";
include ("../header.php");
if (empty($_SESSION['passw'])) $_SESSION['passw']=$pass;
if ($_SESSION['passw']!=$passadmin)
{
$title="ОШИБКА!\n";
echo $div["ten"];
echo "Доступ запрещен!";
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">Войти</a><br/>";
echo $div["end"];
include ("../footer.php");
exit();
}

echo $div["header"];
$q = mysql_query("select * from uzvers;");
$reg=mysql_num_rows($q);
$q1 = mysql_query("select * from clients;");
$cl=mysql_num_rows($q1);
echo "Всего сайтов: <b>$reg</b>";
$q = mysql_query("select * from uzvers where `allmonth`>'0';");
$reg=mysql_num_rows($q);
           while ($field=mysql_fetch_array($q))
           {
           $w=$field['all'];
           $all=$all+$w;
           }
echo ", из них активных: <b>$reg</b><br/>
Клиентов: <b>$cl</b><br/>";
echo $div["end"];
if (empty($op)) $op="index";
switch ($op) {
  case "index":
    echo $div["ten"];
    echo "[!]";echo "<a href=\"index.php?op=news&amp;".session_name()."=".session_id()."\">Новости</a><br/>";
    echo "[!]";echo "<a href=\"index.php?op=ticketplus&amp;".session_name()."=".session_id()."\">Тикетс(+)</a><br/>";
    echo "[!]";echo "<a href=\"index.php?op=ticketmin&amp;".session_name()."=".session_id()."\">Тикетс(-)</a><br/>";
    echo "[!]";echo "<a href=\"index.php?op=allsite&amp;".session_name()."=".session_id()."\">Все сайты</a><br/>";
    echo "[!]";echo "<a href=\"index.php?op=siteready&amp;".session_name()."=".session_id()."\">Готовые к выплатам</a><br/>";
    echo "[!]";echo "<a href=\"index.php?op=sitehelp&amp;".session_name()."=".session_id()."\">Просят выплат</a><br/>";
   echo "[!]";echo "<a href=\"index.php?op=logpoisk&amp;".session_name()."=".session_id()."\">О участике</a>(login)<br/>";
    echo "[!]";echo "<a href=\"index.php?op=about&amp;".session_name()."=".session_id()."\">О участнике</a>(id)<br/>";
    echo "[!]";echo "<a href=\"index.php?op=client&amp;".session_name()."=".session_id()."\">Клиенты</a><br/>";
   echo "+ <a href=\"index.php?op=ref&amp;".session_name()."=".session_id()."\">Рефералы</a><br/>";
   echo "+ <a href=\"index.php?op=reftoid&amp;".session_name()."=".session_id()."\">Пересадка</a><br/>";
    echo "+ <a href=\"index.php?op=rass&amp;".session_name()."=".session_id()."\">Намылить клиентов</a> (рассылка)<br/>";
    echo "+ <a href=\"index.php?op=base&amp;".session_name()."=".session_id()."\">Мыльная фабрика</a> (база)<br/>";
    echo "+ <a href=\"index.php?op=stata&amp;".session_name()."=".session_id()."\">Статистикум</a> (ID сегодня)<br/>";
    echo "[!]";echo "<a href=\"index.php?op=logs&amp;".session_name()."=".session_id()."\">Логи</a><br/>";
    echo "[!]";echo "<a href=\"index.php?op=stats&amp;".session_name()."=".session_id()."\">Статистика</a><br/>";
    echo "[!]";echo "<a href=\"../index.php?".session_name()."=".session_id()."\">Выход</a><br/>";
    break;


case "delchat":
    echo $div["ten"];
if ($yes!=1)
{
echo "Вы действительно хотите очистить чат ?<br/>";
echo "<a href=\"index.php?op=delchat&amp;".session_name()."=".session_id()."&amp;yes=1\">Да</a> | <a href=\"enter.php?".session_name()."=".session_id()."\">Нет</a><br/>";
}
else
{
$q = mysql_query("select * from chat;");
while($row=mysql_fetch_array($q))
{
$idkadelchat=$row['idka'];
    @mysql_query("delete from `chat` where `idka`='$idkadelchat'");
}
    echo "Чат очищен!<br/>";
}
    echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;

case "enterchat":
$login="GRaFiN";
echo "<a href=\"index.php?op=chat&amp;login=$login&amp;".session_name()."=".session_id()."\">GRaFiN</a><br/>";
$login="Arseny";
echo "<a href=\"index.php?op=chat&amp;login=$login&amp;".session_name()."=".session_id()."\">Arseny</a><br/>";
echo "<a href=\"index.php?op=delchat&amp;login=$login&amp;".session_name()."=".session_id()."\">Очистить чат</a><br/>";
break;


case "chat":
if (empty($message))
{
 echo "<form action=\"index.php?op=chat&amp;login=$login&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo $div["ramka"];
echo "<div style=\"text-align:center\">";
           echo "Message: <br/>";
           echo "<input name=\"message\" maxlength=\"250\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo $div["end"];
           echo "</form><br/><br/>";
}
else
{
$dater=date("d.m.Y H:i:s");
mysql_query("insert into chat set pid='$login',date='$dater',mess='$message'") or die ('System Error!');
$message='';
           echo "<div style=\"text-align:center\">";
           echo "<form action=\"index.php?op=chat&amp;login=$login&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo $div["ramka"];
           echo "Message<br/><input name=\"message\" maxlength=\"250\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo $div["end"];
           echo "</form></div><br/><br/>";
}
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=10;
$arr = mysql_query("select * from `chat`");
$qi = mysql_query("select * from `chat` order by `idka` desc limit $startan,$num_msgs_an;;");
$t=mysql_affected_rows();
if ($t==0)
{
echo "Нет чата!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$r1=$row['pid'];
$r2=$row['date'];
$r3=$row['mess'];
$r4=$row['idka'];
$r5=$row['answ'];
if ($r1=='Arseny' or $r1=='GRaFiN')
{
echo "<b><font color=\"lime\">$r1</font> [Admin]</b><br/>$r2<br/>$r3<hr/>";
}
else
{
echo "<b>$r1</b><br/>$r2<br/>$r3";
echo "<br/>Ответ: $r5<br/>";
echo "<a href=\"index.php?op=delmess&amp;r4=$r4&amp;login=$login&amp;".session_name()."=".session_id()."\">Удал</a> <a href=\"index.php?op=messizm&amp;r4=$r4&amp;r3=$r3&amp;login=$login&amp;".session_name()."=".session_id()."\">Изм</a> <a href=\"index.php?op=otvmess&amp;r4=$r4&amp;login=$login&amp;".session_name()."=".session_id()."\">Ответ</a><br/><hr/>";
}
}
}
$i = @mysql_num_rows($arr);
if($startan!=0)
echo "<a href=\"index.php?op=chat&amp;login=$login&amp;".session_name()."=".session_id()."&amp;startan=".($startan-$num_msgs_an)."\">".htmlspecialchars("<<--")."</a>] ";
if($i>$startan+$num_msgs_an)
echo "[<a href=\"index.php?op=chat&amp;login=$login&amp;".session_name()."=".session_id()."&amp;startan=".($startan+$num_msgs_an)."\">".htmlspecialchars("-->>")."</a>";;
echo "# ";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;

case "delmess":
    echo $div["ten"];
if ($yes!=1)
{
echo "Вы действительно хотите удалить сообщение с id $r4 ?<br/>";
echo "<a href=\"index.php?op=delmess&amp;r4=$r4&amp;".session_name()."=".session_id()."&amp;yes=1\">Да</a> | <a href=\"enter.php?".session_name()."=".session_id()."\">Нет</a><br/>";
}
else
{
    @mysql_query("delete from `chat` where `idka`='$r4'");
    echo "Мессага удалена!<br/>";
}
    echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;

case "messizm":
echo $div["ten"];
if ($yes!=1)
{
echo "ID: $r4<br/>";
echo "Мессага: $r3<br/>";
echo"<form action=\"index.php?\" method=\"get\">Изменить на: <input type=\"text\" name=\"bal\"/><br/>
<input type=\"hidden\" name=\"op\" value=\"messizm\"/>
<input type=\"hidden\" name=\"r4\" value=\"$r4\"/>
<input type=\"hidden\" name=\"r3\" value=\"$r3\"/>
<input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\"/>
<input type=\"hidden\" name=\"yes\" value=\"1\"/>
<input type=\"submit\" value=\"Обновить\"/></form>";
}
else
{
@mysql_query("UPDATE `chat` SET `mess`='$bal' WHERE `idka`='$r4';");
echo "Мессага $r4 изменена на $bal<br/>";
echo "# ";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
}
break;


case "otvmess":
echo $div["ten"];
if ($yes!=1)
{
echo "ID: $r4<br/>";
echo "Мессага: $r3<br/>";
echo"<form action=\"index.php?\" method=\"get\">Ответ: <input type=\"text\" name=\"bal\"/><br/>
<input type=\"hidden\" name=\"op\" value=\"otvmess\"/>
<input type=\"hidden\" name=\"r4\" value=\"$r4\"/>
<input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\"/>
<input type=\"hidden\" name=\"yes\" value=\"1\"/>
<input type=\"submit\" value=\"Обновить\"/></form>";
}
else
{
@mysql_query("UPDATE `chat` SET `answ`='$bal' WHERE `idka`='$r4';");
echo "Мессага $r4 ответ изменен на $bal<br/>";
echo "# ";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
}
break;

case "bir":
echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=20;
$qi = mysql_query("select * from `uzvers` order by `cena` desc limit $startan,$num_msgs_an;;");
if (mysql_affected_rows()==0)
{
echo "Нет сайтов!";
}
else
{
while($row=mysql_fetch_array($qi))
{
$x=$row['prod'];
if ($x==1)
{
$r1=$row['id']; $r2=$row['cena']; $r3=$row['partid'];
echo "ID: $r1 Цена: $r2<br/>";
$s=$row['allmonth']+$row['opl'];
echo "Общий заработок: $s<br/>";
echo "Продавец: id $r3<br/>";
echo "<a href=\"kupref.php?r1=$r1&amp;r2=$r2&amp;r3=$r3&amp;".session_name()."=".session_id()."\">Купить</a><br/>";
echo "<a href=\"index.php?op=otmbir&amp;r1=$r1&amp;r2=$r2&amp;r3=$r3&amp;".session_name()."=".session_id()."\">Отменить продажу</a><br/>";
echo "<a href=\"index.php?op=birk&amp;r1=$r1&amp;r2=$r2&amp;r3=$r3&amp;".session_name()."=".session_id()."\">Корректировать цену</a><br/>";
}
echo "<hr/>";
}
}

echo $div["end"];
break;

case "otmbir":
if ($yes!=1)
{
echo "Вы действительно хотите Удалить продажу реферала с id $r1 по цене $r2 у.е.?<br/>";
echo "<a href=\"index.php?op=otmbir&amp;r1=$r1&amp;r2=$r2&amp;r3=$r3&amp;".session_name()."=".session_id()."&amp;yes=1\">Да</a> | <a href=\"enter.php?".session_name()."=".session_id()."\">Нет</a><br/>";
}
else
{
 @mysql_query("UPDATE `uzvers` SET `prod`='0' where `id`='$r1'");
 echo "Продажа успешно отменена<br/>";
}
break;

case "birk":
echo $div["ten"];
if ($yes!=1)
{
$q_msg = mysql_query("select * from `uzvers` where (`id`='$id');");
$row_msg=mysql_fetch_array($q_msg);
$ballall=$row_msg['allmonth'];
echo "Цена: $r2<br/>";
echo"<form action=\"index.php\" method=\"get\">Новая цена: <input type=\"text\" name=\"bal\"/><br/>
<input type=\"hidden\" name=\"op\" value=\"birk\"/>
<input type=\"hidden\" name=\"r1\" value=\"$r1\"/>
<input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\"/>
<input type=\"hidden\" name=\"yes\" value=\"1\"/>
<input type=\"submit\" value=\"Обновить\"/></form>";
}
else
{
@mysql_query("UPDATE `uzvers` SET `cena`='$bal' WHERE `id`='$r1';");
echo "Цена обновлена и составляет $bal!<br/>";
echo "<img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
}
break;


 case "birka":
$file_name = "../birka/all.log"; //file with links
$sim=10; //how much links on page
if(!isset($_GET['p']))$p=0; else $p = $_GET['p'];
$file=file($file_name);
$all=count($file);
$obsum = $all - $p * $sim;
$nasum = $obsum - $sim;
$end='0';
echo "Дата || Откуда || Куда || Сколько <br/>";
for($i=$obsum; $i>$nasum; $i--)
{
if(!isset($file[$i])) {$end='1';} else {$file[$i]=str_replace("\n","<br/>",$file[$i]);
$read.=$file[$i]; }

}
if($end=='1') $read.="<br/>";
$read=str_replace("&","&amp;",$read);//$read=iconv("Windows-1251", "UTF-8", $read); echo $read;
$echo .="---";
$echo .= '<br/><a href="'.$PHP_SELF.'?'.session_name().'='.session_id().'&amp;p='.($p+1).'&amp;id='.$id.'&amp;op=perevoda">След</a>';$echo .= ' ';
$echo .= '<br/><a href="'.$PHP_SELF.'?'.session_name().'='.session_id().'&amp;p='.($p-1).'&amp;id='.$id.'&amp;op=perevoda">Пред</a>';
echo $read;
echo $echo;
echo $div["div"];
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;
case "koshelek":
echo $div["ten"];
if ($yes!=1)
{
$q_msg = mysql_query("select * from `uzvers` where (`id`='$id');");
$row_msg=mysql_fetch_array($q_msg);
$ballall=$row_msg['allmonth'];
echo "Баланс: $ballall<br/>";
echo"<form action=\"index.php\" method=\"get\">Новый баланс: <input type=\"text\" name=\"bal\"/><br/>
<input type=\"hidden\" name=\"op\" value=\"koshelek\"/>
<input type=\"hidden\" name=\"id\" value=\"$id\"/>
<input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\"/>
<input type=\"hidden\" name=\"yes\" value=\"1\"/>
<input type=\"submit\" value=\"Обновить\"/></form>";
}
else
{
@mysql_query("UPDATE `uzvers` SET `allmonth`='$bal' WHERE `id`='$id';");
$q_ms = mysql_query("select * from `uzvers` where (`id`='$id');");
$row_ms=mysql_fetch_array($q_ms);
$ba=$row_ms['allmonth'];
echo "Баланс обновлен и составляет $ba!<br/>";
echo "<img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
}
break;

case "refmax":
echo $div["ten"];
if ($yes!=1)
{
$q_msg = mysql_query("select * from `uzvers` where (`id`='$id');");
$row_msg=mysql_fetch_array($q_msg);
$ballall=$row_msg['col'];
echo "Реф: $ballall<br/>";
echo"<form action=\"index.php\" method=\"get\">Новый баланс: <input type=\"text\" name=\"bal\"/><br/>
<input type=\"hidden\" name=\"op\" value=\"refmax\"/>
<input type=\"hidden\" name=\"id\" value=\"$id\"/>
<input type=\"hidden\" name=\"".session_name()."\" value=\"".session_id()."\"/>
<input type=\"hidden\" name=\"yes\" value=\"1\"/>
<input type=\"submit\" value=\"Обновить\"/></form>";
}
else
{
@mysql_query("UPDATE `uzvers` SET `col`='$bal' WHERE `id`='$id';");
$q_ms = mysql_query("select * from `uzvers` where (`id`='$id');");
$row_ms=mysql_fetch_array($q_ms);
$ba=$row_ms['col'];
echo "Рефы обновлены и составляют $ba!<br/>";
echo "<img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
}
break;



case "logpoisk":
echo $div ['ten'];
 if (empty($loginrt))
           {
                      if ($_SESSION['wap']=="xml")
           {

           echo "<form action=\"index.php?op=logpoisk&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo $div["ten"];
           echo "[!]";echo "Введите логин: <br/>";
           echo "<input name=\"loginrt\" maxlength=\"250\"title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
          echo "<br/><img src=\"pics/st.gif\" alt=\"*\"/>";echo "<a href=\"enter.php?".session_name()."=".session_id()."\">Панель</a><br/>";
           echo $div["end"];
           echo "</form>";
           }
           else
           {
           echo "[!]";echo "Логин: <br/>";
           echo "</small><input name=\"login".$ref."\" value=\"1\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"perevod.php?".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"login\" value=\"$(login".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }}
else {  
        $qi = mysql_query("select * from `uzvers` where `log`='$loginrt';");
           if (mysql_affected_rows()==0)
           {
           echo "Нет такого логина !!!";
           }
           else
           {
$row=mysql_fetch_array($qi);
echo "ID: <b>".$row['id']."</b> <br/>
Логин: ".$row['log']." <br/>
Пароль: ".$row['psss']." <br/>
WMZ: ".$row['wm']." <br/>
Мыло: ".$row['email']." <br/>
Сайт: ".$row['site']." <br/>
ICQ: ".$row['icq']." <br/>
Баланс ".$row['allmonth']." <br/>";
}

  if ($autorize) {echo "<img src=\"pics/st.gif\" alt=\"*\"/>";echo "<a href=\"enter.php?".session_name()."=".session_id()."\">Панель</a><br/>";}
else {echo "<img src=\"pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?".session_name()."=".session_id()."\">Назад</a><br/>";}}
echo $div["end"];
include ("footer.php");
break;





   case "ref":
    if (empty($id))
    {
           if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"index.php?op=ref&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "ID: <br/>";
           echo "<input name=\"id\" maxlength=\"250\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "ID: <br/>";
           echo "</small><input name=\"id".$ref."\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=ref&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"id\" value=\"$(id".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }    }
  else 
   {

    $qi = mysql_query("select * from `uzvers` where `partid`='".$id."';");
if (mysql_affected_rows()==0)
{
echo "У этого партнера нет рефералов!";
}
else
{
$col=mysql_affected_rows();
echo "Всего рефералов: $col<br/>";
while($row=mysql_fetch_array($qi))
{
$part=$row['allmonth']*$partproc/100;
$partt=$row['all']*$partproc/100;
$part=substr($part,0,5);
$site=$row['site'];
echo "<a href=\"$site\">$site</a> [$partt y.e.] [$part y.e.]<br/>";
$all=$all+$part;
}}}
echo $div["div"];
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;

case "base":
echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=20;
$arr = mysql_query("select * from `uzvers`");
$qi = mysql_query("select * from `uzvers` order by `allmonth` desc limit $startan,$num_msgs_an;;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет сайтов!";
           }
           else
           {
while($row=mysql_fetch_array($qi))
{
echo "".$row['email']."<br/>";
}
           }
$i = @mysql_num_rows($arr);
if($startan!=0)
echo "<a href=\"index.php?op=base&amp;".session_name()."=".session_id()."&amp;startan=".($startan-$num_msgs_an)."\">".htmlspecialchars("<<--")."</a>] ";
if($i>$startan+$num_msgs_an)
echo "[<a href=\"index.php?op=base&amp;".session_name()."=".session_id()."&amp;startan=".($startan+$num_msgs_an)."\">".htmlspecialchars("-->>")."</a>";;
    echo "<br/>[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;



case "stata":
  if (empty($id))
    {
           if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"index.php?op=stata&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "ID: <br/>";
           echo "<input name=\"id\" maxlength=\"250\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "ID: <br/>";
           echo "</small><input name=\"id".$ref."\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=stata&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"id\" value=\"$(id".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }

    }
    else
{
$q = mysql_query("select * from uzvers where `id`='$id';");
$reg=mysql_num_rows($q);
$field=mysql_fetch_array($q);
$all=$field['all'];
for ($i=1;$i<33;$i++)
{
$oper=$i;
include ("../func/spop.php");
if ($otk[$i]!=0)
{
$host=$field[$i];
$cost=$host*($cena[$i]/1000);
echo "$oper_name | $host | $cost<br/>";
}
$allcost=$allcost+$cost;
}
}
echo $div["div"];
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;


case "statad":
$q = mysql_query("select * from uzvers");
$reg=mysql_num_rows($q);
           while ($field=mysql_fetch_array($q))
           {
for ($i=1;$i<33;$i++)
{
$oper=$i;
include ("../func/spop.php");
if ($otk[$i]!=0)
{
$d=$host;
$host=$field[$i];
$d=$d+$host;
$cost=$cost+$host*($cena[$i]/1000);
}
echo "$oper_name | $d | $cost<br/>";
}
}
echo $div["div"];
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;



 case "reftoid":
    if (empty($id))
    {
           if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"index.php?op=reftoid&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "ID: <br/>";
            echo "[!]";echo "id кому: <br/>";
           echo "<input name=\"id1\" maxlength=\"250\" value=\"1\" title=\"Text\"/><br/>";
           echo "[!]";echo "id кого: <br/>";
           echo "<input name=\"id\" maxlength=\"250\" value=\"2\" title=\"Text\"/><br/>";
      echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "id кому: <br/>";
           echo "</small><input name=\"id1".$ref."\" value=\"1\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "id кого: <br/>";
           echo "</small><input name=\"id".$ref."\" value=\"2\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=reftoid&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"id1\" value=\"$(passc".$ref.")\"/>";
           echo "<postfield name=\"id\" value=\"$(email".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }    }
  else 
   {
  $qi = mysql_query("select * from `uzvers`");
while($row=mysql_fetch_array($qi))
{
if ($row['id']=$id) $per1=$row['partid'];
}
@mysql_query("UPDATE `uzvers` SET `col`=`col`-'1' where `id`='$per1'");
@mysql_query("UPDATE `uzvers` SET `col`=`col`+'1' where `id`='$id1'");
@mysql_query("UPDATE `uzvers` SET `partid`='$id1' where `id`='$id'");
echo "Операция по пересадке реферала успешно выполнена :)";
}
echo $div["div"];
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;







case "rass":
echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=10000;
$arr = mysql_query("select * from `uzvers`");
$qi = mysql_query("select * from `uzvers` order by `allmonth` desc limit $startan,$num_msgs_an;;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет сайтов!";
           }
           else
           {
           echo "Внимание! Рассылка уже работает! Уважайте клиентов!<br/>";
 if (empty($body))
{
           echo "<form action=\"index.php?op=rass&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "Содержание: <br/>";
           echo "<input name=\"body\" maxlength=\"750\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
}
else
{
while($row=mysql_fetch_array($qi))
{
$mail=$row['email'];
$sent="clicks.net.ru";
$subject="Рассылка clicks.net.ru";
$subject = convert_cyr_string($subject, 'w','k');
$body = convert_cyr_string($body, 'w','k');
$adds = "From: $sent \n";
$adds .= "X-sender: < $sent >\n";
$adds .= "Content-Type: text/plain; charset=koi8-r\n";
mail($mail,$subject,$body,$adds);
}
$col=mysql_affected_rows();
echo "Отправлено писем: $col <br/>";
echo "Писали в письмах: <br/> <font color=\"red\">
$body </font><br/>";
echo "Рассылка успешно произведена!";
           }

} 
    echo "<br/><a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;


  case "news":
    if ($mod=="add")
{
           if (empty($message))
           {
                      if ($_SESSION['wap']=="xml")
           {

           echo "<form action=\"index.php?op=news&amp;mod=add&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo $div["ten"];
           echo "[!]";echo "Новость: <br/>";
           echo "<input name=\"message\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
           echo "<select multiple=\"multiple\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo $div["end"];
           echo "</form>";
           }
           else
           {
           echo "[!]";echo "Новость: <br/>";
           echo "</small><input name=\"message".$ref."\" value=\"$msg_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "</small><select multiple=\"true\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><small><br/>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=news&amp;mod=add&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"message\" value=\"$(message".$ref.")\"/>";
           echo "<postfield name=\"translit\" value=\"$(translit)\"/>";
           echo "</go></anchor><br/>";
           }
           }
           else
           {
           echo $div["ten"];
           if($translit==1) $message=latrus($message);
           @mysql_query("insert into `news` values(0,'$date','$message');")or die ("FUCK");
           echo "Новость добавлена!<br/>";
           echo "<img src=\"pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?op=news&amp;".session_name()."=".session_id()."\">Новости</a><br/>";
           echo "<img src=\"pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
           echo $div["end"];
           }
           include ("../footer.php");
           exit();
}
echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=5;
$arr = mysql_query("select * from `news`");
$qi = mysql_query("select * from `news` order by `id` desc limit $startan,$num_msgs_an;;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет новостей";
           }
           else
           {
while($row=mysql_fetch_array($qi))
{
echo "".$row['date']." |
".$row['msg']." <a href=\"index.php?op=editnews&amp;postid=".$row['id']."&amp;".session_name()."=".session_id()."\">ред</a> <a href=\"index.php?op=delnews&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">удал</a><br/>";
}
           }
$i = @mysql_num_rows($arr);
if($startan!=0)
echo "<a href=\"index.php?op=news&amp;".session_name()."=".session_id()."&amp;startan=".($startan-$num_msgs_an)."\">".htmlspecialchars("<<--")."</a>] ";
if($i>$startan+$num_msgs_an)
echo "[<a href=\"index.php?op=news&amp;".session_name()."=".session_id()."&amp;startan=".($startan+$num_msgs_an)."\">".htmlspecialchars("-->>")."</a>";;
echo "<br/>[!]";echo "<a href=\"index.php?op=news&amp;mod=add&amp;".session_name()."=".session_id()."\">Добавить Новость</a><br/>";
    echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;





    case "editnews":
    if (empty($go))
           {
           $q_msg = mysql_query("select * from `news` where (`id`='$postid');");
           $row_msg=mysql_fetch_array($q_msg);
           $msg_db=$row_msg['msg'];
                      if ($_SESSION['wap']=="xml")
           {

           echo "<form action=\"index.php?op=editnews&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<div>";
           echo "Сообщение: <br/>";
           echo "<input name=\"message\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
           echo "<select multiple=\"multiple\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "Сообщение: <br/>";
           echo "</small><input name=\"message".$ref."\" value=\"$msg_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "</small><select multiple=\"true\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><small><br/>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=editnews&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"message\" value=\"$(message".$ref.")\"/>";
           echo "<postfield name=\"translit\" value=\"$(translit)\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           if ($_SESSION['wap']!="xml") {echo "---<br/>";}
           echo $div["end"];
           include ("../footer.php");
           exit();
           }
           else
           {
           @mysql_query("UPDATE `news` SET `msg`='$message' WHERE (`id`='$postid')");
           echo "Новость изменена!<br/>";
           echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
           }
    break;






    case "delnews":
    echo $div["ten"];
    @mysql_query("delete from `news` where `id`='$id'");
    echo "Новость удалена!<br/>";
    echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;





    case "ticketplus":
    echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=5;
$arr = mysql_query("select * from `support`");
$qi = mysql_query("select * from `support` where `ans`!='' order by `id` desc limit $startan,$num_msgs_an;;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет тикетов";
           }
           else
           {
while($row=mysql_fetch_array($qi))
{
$msg1=htmlspecialchars(stripslashes(trim($row['msg'])));
$msg1=str_replace("&","&amp;",$msg1);
$row['ans']=str_replace("&","&amp;",$row['ans']);
echo "#".$row['id']." | ".$row['date']." | ID:".$row['idc']." |
".$msg1." |<b>
".$row['ans']."</b> <a href=\"index.php?op=editticket&amp;postid=".$row['id']."&amp;".session_name()."=".session_id()."\">ред</a> <a href=\"index.php?op=deltick&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">удал</a><br/>";
}
           }
$i = @mysql_num_rows($arr);
if($startan!=0)
echo "<a href=\"index.php?op=ticketplus&amp;".session_name()."=".session_id()."&amp;startan=".($startan-$num_msgs_an)."\">".htmlspecialchars("<<--")."</a>] ";
if($i>$startan+$num_msgs_an)
echo "[<a href=\"index.php?op=ticketplus&amp;".session_name()."=".session_id()."&amp;startan=".($startan+$num_msgs_an)."\">".htmlspecialchars("-->>")."</a>";;
    echo "<br/>[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;


    ###
    case "ticketmin":
    echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=5;
$arr = mysql_query("select * from `support` where `ans`=''");
$qi = mysql_query("select * from `support` where `ans`='' order by `id` desc limit $startan,$num_msgs_an;;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет тикетов";
           }
           else
           {
while($row=mysql_fetch_array($qi))
{
$row['msg']=htmlspecialchars(stripslashes(trim($row['msg'])));
$row['msg']=str_replace("&","&amp;",$row['msg']);
echo "#".$row['id']." | ".$row['date']." | ID:".$row['idc']." |
".$row['msg']."  <a href=\"index.php?op=answ&amp;postid=".$row['id']."&amp;".session_name()."=".session_id()."\">отв</a> <a href=\"index.php?op=deltick&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">удал</a><br/>";
}
           }
$i = @mysql_num_rows($arr);
if($startan!=0)
echo "<a href=\"index.php?op=ticketmin&amp;".session_name()."=".session_id()."&amp;startan=".($startan-$num_msgs_an)."\">".htmlspecialchars("<<--")."</a>] ";
if($i>$startan+$num_msgs_an)
echo "[<a href=\"index.php?op=ticketmin&amp;".session_name()."=".session_id()."&amp;startan=".($startan+$num_msgs_an)."\">".htmlspecialchars("-->>")."</a>";;
    echo "<br/>[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;




        case "deltick":
    echo $div["ten"];
    @mysql_query("delete from `support` where `id`='$id'");
    echo "Тикет удалён!<br/>";
    echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;


    case "editticket":
    if (empty($go))
           {
           $q_msg = mysql_query("select * from `support` where (`id`='$postid');");
           $row_msg=mysql_fetch_array($q_msg);
           $msg_db=$row_msg['ans'];
                      if ($_SESSION['wap']=="xml")
           {

           echo "<form action=\"index.php?op=editticket&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<div>";
           echo "Сообщение: <br/>";
           echo "<input name=\"message\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
           echo "<select multiple=\"multiple\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "Сообщение: <br/>";
           echo "</small><input name=\"message".$ref."\" value=\"$msg_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "</small><select multiple=\"true\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><small><br/>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=editticket&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"message\" value=\"$(message".$ref.")\"/>";
           echo "<postfield name=\"translit\" value=\"$(translit)\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           if ($_SESSION['wap']!="xml") {echo "---<br/>";}
           echo $div["end"];
           include ("../footer.php");
           exit();
           }
           else
           {
           echo $div["div"];
           @mysql_query("UPDATE `support` SET `ans`='$message' WHERE (`id`='$postid')");
           echo "Ответ изменен!<br/>";
           echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
           }
    break;




        case "answ":
    if (empty($go))
           {
           $q_msg = mysql_query("select * from `support` where (`id`='$postid');");
           $row_msg=mysql_fetch_array($q_msg);
           $msg_db=$row_msg['ans'];
                      if ($_SESSION['wap']=="xml")
           {

           echo "<form action=\"index.php?op=answ&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<div>";
           echo "Сообщение: <br/>";
           echo "<input name=\"message\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
           echo "<select multiple=\"multiple\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "Сообщение: <br/>";
           echo "</small><input name=\"message".$ref."\" value=\"$msg_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "</small><select multiple=\"true\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><small><br/>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=answ&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"message\" value=\"$(message".$ref.")\"/>";
           echo "<postfield name=\"translit\" value=\"$(translit)\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           if ($_SESSION['wap']!="xml") {echo "---<br/>";}
           echo $div["end"];
           include ("../footer.php");
           exit();
           }
           else
           {
           echo $div["div"];
           @mysql_query("UPDATE `support` SET `ans`='$message' WHERE (`id`='$postid')");
           echo "Ответ добавлен!<br/>";
           echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
           }
    break;








case "allsite":
echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=20;
$arr = mysql_query("select * from `uzvers`");
$qi = mysql_query("select * from `uzvers` order by `allmonth` desc limit $startan,$num_msgs_an;;");
if (mysql_affected_rows()==0)
{
echo "Нет сайтов!";
}
else
{
while($row=mysql_fetch_array($qi))
{
echo "".$row['id']." | ".$row['wm']." |
<a href=\"".$row['site']."\">".$row['site']."</a> ".$row['allmonth']."";
if(trim($row['ban'])==1){echo" ЗАБАНЕН";}
echo" <a href=\"index.php?op=koshelek&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">бал</a> <a href=\"index.php?op=opl&amp;postid=".$row['id']."&amp;".session_name()."=".session_id()."\">опл</a><a href=\"index.php?op=delsite&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">удл</a> <a href=\"index.php?op=bansite&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">ban</a> <a href=\"index.php?op=razbansite&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">разбан</a><br/>";
}
}
$i = @mysql_num_rows($arr);
if($startan!=0)
echo "<a href=\"index.php?op=allsite&amp;".session_name()."=".session_id()."&amp;startan=".($startan-$num_msgs_an)."\">".htmlspecialchars("<<--")."</a>] ";
if($i>$startan+$num_msgs_an)
echo "[<a href=\"index.php?op=allsite&amp;".session_name()."=".session_id()."&amp;startan=".($startan+$num_msgs_an)."\">".htmlspecialchars("-->>")."</a>";;
echo "<br/>[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;


case "ban2site":
echo $div["ten"];
if ($yes!=1)
{
echo "Вы действительно хотите ЗАБАНИТЬ сайт, ID[$id] c обнулением баланса?<br/>";
echo "<a href=\"index.php?op=ban2site&amp;id=$id&amp;".session_name()."=".session_id()."&amp;yes=1\">Да</a> | <a href=\"index.php?".session_name()."=".session_id()."\">Нет</a><br/>";

}
else
{
$q_msg = mysql_query("select * from `uzvers` where (`id`='$id');");
$row_msg=mysql_fetch_array($q_msg);
@mysql_query("UPDATE `uzvers` SET `ban`='1' where `id`='$id'");
@mysql_query("UPDATE `uzvers` SET `allmonth`='0' WHERE `id`='$id';");
echo "Сайт забанен!<br/>";
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
}
break;


case "siteready":
echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=20;
$arr = mysql_query("select * from `uzvers` where `allmonth`>'$mincost'");
$qi = mysql_query("select * from `uzvers` where `allmonth`>'$mincost' order by `allmonth` desc limit $startan,$num_msgs_an;;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет сайтов!";
           }
           else
           {
while($row=mysql_fetch_array($qi))
{
echo "".$row['id']." | ".$row['wm']." |
".$row['allmonth']."   
<a href=\"index.php?op=opl&amp;postid=".$row['id']."&amp;".session_name()."=".session_id()."\">опл</a> |
<a href=\"index.php?op=logs&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">log</a> |
<a href=\"index.php?op=ban2site&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">ban</a>* |
<a href=\"".$row['site']."\">".$row['site']."</a> <br/>";
}
           }
$i = @mysql_num_rows($arr);
if($startan!=0)
echo "<a href=\"index.php?op=siteready&amp;".session_name()."=".session_id()."&amp;startan=".($startan-$num_msgs_an)."\">".htmlspecialchars("<<--")."</a>] ";
if($i>$startan+$num_msgs_an)
echo "[<a href=\"index.php?op=siteready&amp;".session_name()."=".session_id()."&amp;startan=".($startan+$num_msgs_an)."\">".htmlspecialchars("-->>")."</a>";
echo"<br/><br/><a href=\"index.php?op=oplall&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">Выплатить всем!</a><br/><br/>";
echo "* - Бан с обнулением баланса!";
    echo "<br/>[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;




case "oplall":
echo $div["ten"];
if ($yes!=1)
{
echo "Вы действительно хотите ВСЕМ выплатить?<br/>";
echo "<a href=\"index.php?op=oplall&amp;".session_name()."=".session_id()."&amp;yes=1\">Да</a> | <a href=\"index.php?".session_name()."=".session_id()."\">Нет</a><br/>";

}
else
{
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=20;
$arr = mysql_query("select * from `uzvers` where `allmonth`>'$mincost'");
$qi = mysql_query("select * from `uzvers` where `allmonth`>'$mincost' order by `allmonth` desc limit $startan,$num_msgs_an;;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет сайтов!";
           }
           else
           {
while($row=mysql_fetch_array($qi))
{
$id=$row['id'];
$msg_db=$row_msg['allmonth'];
@mysql_query("UPDATE `uzvers` SET `allmonth`=0,`opl`=`opl`+'$row_msg',`help`='0' WHERE (`id`='$id')");
}}
echo "ВЫплачено ВСЕМ...<br/>";
echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
}
break;


    case "delsite":
    echo $div["ten"];
    if ($yes!=1)
    {
    echo "Вы действительно хотите удалить сайт, ID[$id]?<br/>";
    echo "<a href=\"index.php?op=delsite&amp;id=$id&amp;".session_name()."=".session_id()."&amp;yes=1\">Да</a> | <a href=\"index.php?".session_name()."=".session_id()."\">Нет</a><br/>";

    }
    else
    {
    $q_msg = mysql_query("select * from `uzvers` where (`id`='$id');");
    $row_msg=mysql_fetch_array($q_msg);
    $ballall=$row_msg['allmonth'];
    $part=$row_msg['partid'];
    $ball=($ballall*15)/100;
    @mysql_query("delete from `uzvers` where `id`='$id'");
    @mysql_query("UPDATE `uzvers` SET `allmonth`=`allmonth`-'$ball' WHERE `id`='$part';");
    echo "Сайт удалён! <br/>";
    echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    }
    break;

    case "bansite":
    echo $div["ten"];
    if ($yes!=1)
    {

    echo "Вы действительно хотите ЗАБАНИТЬ сайт, ID[$id]?<br/>";
    echo "<a href=\"index.php?op=bansite&amp;id=$id&amp;".session_name()."=".session_id()."&amp;yes=1\">Да</a> | <a href=\"index.php?".session_name()."=".session_id()."\">Нет</a><br/>";

    }
    else
    {
    $q_msg = mysql_query("select * from `uzvers` where (`id`='$id');");
    $row_msg=mysql_fetch_array($q_msg);
    $ballall=$row_msg['allmonth'];
    $part=$row_msg['partid'];
    $ball=($ballall*15)/100;
    @mysql_query("UPDATE `uzvers` SET `ban`='1' where `id`='$id'");
    @mysql_query("UPDATE `uzvers` SET `allmonth`=`allmonth`-'$ball' WHERE `id`='$part';");
    echo "Сайт забанен!<br/>";
    echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    }
    break;

case "razbansite":
echo $div["ten"];
if ($yes!=1)
{

echo "Вы действительно хотите РАЗБАНИТЬ сайт, ID[$id]?<br/>";
echo "<a href=\"index.php?op=razbansite&amp;id=$id&amp;".session_name()."=".session_id()."&amp;yes=1\">Да</a> | <a href=\"index.php?".session_name()."=".session_id()."\">Нет</a><br/>";
}
else
{
$q_msg = mysql_query("select * from `uzvers` where (`id`='$id');");
$row_msg=mysql_fetch_array($q_msg);
$ballall=$row_msg['allmonth'];
$part=$row_msg['partid'];
$ball=($ballall*15)/100;
@mysql_query("UPDATE `uzvers` SET `ban`='0' where `id`='$id'");
@mysql_query("UPDATE `uzvers` SET `allmonth`=`allmonth`-'$ball' WHERE `id`='$part';");
echo "Сайт разбанен!<br/>";
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
}
break;
       case "opl":
    if (empty($go))
           {
           $q_msg = mysql_query("select * from `uzvers` where (`id`='$postid');");
           $row_msg=mysql_fetch_array($q_msg);
           $msg_db=$row_msg['allmonth'];
                      if ($_SESSION['wap']=="xml")
           {

           echo "<form action=\"index.php?op=opl&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<div>";
           echo "Сколько платим?: <br/>";
           echo "<input name=\"sum\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Платить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "Сколько платим?: <br/>";
           echo "</small><input name=\"sum".$ref."\" value=\"$msg_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Платить<go href=\"index.php?op=opl&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"sum\" value=\"$(sum".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           if ($_SESSION['wap']!="xml") {echo "---<br/>";}
           echo $div["end"];
           include ("../footer.php");
           exit();
           }
           else
           {
           @mysql_query("UPDATE `uzvers` SET `allmonth`=`allmonth`-'$sum',`opl`=`opl`+'$sum',`help`='0' WHERE (`id`='$postid')");
           echo "Оплаченно!<br/>";
           echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
           }
    break;








    case "client":
    if ($mod=="add")
			{
           if (empty($site))
           {
                      if ($_SESSION['wap']=="xml")
           {

           echo "<form action=\"index.php?op=client&amp;mod=add&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo $div["ten"];
           echo "[!]";echo "E-mail: <br/>";
           echo "<input name=\"email\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
           echo "[!]";echo "Сайт: <br/>";
           echo "<input name=\"site\" maxlength=\"250\" value=\"http://\" title=\"Text\"/><br/>";
           echo "<select multiple=\"multiple\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo $div["end"];
           echo "</form>";
           }
           else
           {
           echo "[!]";echo "E-mail: <br/>";
           echo "</small><input name=\"email".$ref."\" value=\"$msg_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "[!]";echo "Сайт: <br/>";
           echo "</small><input name=\"site".$ref."\" value=\"http://\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "</small><select multiple=\"true\" name=\"translit\">
           <option value=\"1\">Транслит</option></select><small><br/>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=client&amp;mod=add&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"email\" value=\"$(email".$ref.")\"/>";
           echo "<postfield name=\"site\" value=\"$(site)\"/>";
           echo "</go></anchor><br/>";
           }
           }
           else
           {
           echo $div["ten"];
           if($translit==1) $message=latrus($message);
           $parol=md5($rd);
           $parol=substr($parol,25);
           @mysql_query("insert into `clients` values(0,'$parol','$email','$site','0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '', '$mes', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '0', '0', '', '', '', '', '$date_db', '0', '0');")or die ("FUCK");
           $id_s=mysql_insert_id();
           echo "Сайт <b>$site</b> добавлен!<br/>ID: <b>$id_s</b><br/> Пароль: <b>$parol</b><br/>";
           echo "<img src=\"pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?op=client&amp;".session_name()."=".session_id()."\">Клиенты</a><br/>";
           echo "<img src=\"pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
           echo $div["end"];
           }
           include ("../footer.php");
           exit();
}
echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=5;
$arr = mysql_query("select * from `clients`");
$qi = mysql_query("select * from `clients` order by `id` desc limit $startan,$num_msgs_an;;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет сайтов ";
           }
           else
           {
while($row=mysql_fetch_array($qi))
{
echo "<b>".$row['id']."</b> |
".$row['psss']." |
".$row['email']." |
".$row['site']." |
".$row['balans']."
<a href=\"index.php?op=clientop&amp;postid=".$row['id']."&amp;".session_name()."=".session_id()."\">Пополнить</a>
 <a href=\"index.php?op=editclient&amp;postid=".$row['id']."&amp;".session_name()."=".session_id()."\">ред</a>
<a href=\"index.php?op=delclient&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">уд</a><br/>";
}
           }
$i = @mysql_num_rows($arr);
if($startan!=0)
echo "<a href=\"index.php?op=client&amp;".session_name()."=".session_id()."&amp;startan=".($startan-$num_msgs_an)."\">".htmlspecialchars("<<--")."</a>] ";
if($i>$startan+$num_msgs_an)
echo "[<a href=\"index.php?op=client&amp;".session_name()."=".session_id()."&amp;startan=".($startan+$num_msgs_an)."\">".htmlspecialchars("-->>")."</a>";;
echo "<br/>[!]";echo "<a href=\"index.php?op=client&amp;mod=add&amp;".session_name()."=".session_id()."\">Добавить сайт</a><br/>";
    echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;






    case "editclient":
    if (empty($go))
           {
           $q_msg = mysql_query("select * from `clients` where (`id`='$postid');");
           $row_msg=mysql_fetch_array($q_msg);
           $id_db=$row_msg['id'];
           $passw_db=$row_msg['psss'];
           $email_db=$row_msg['email'];
           $site_db=$row_msg['site'];
                      if ($_SESSION['wap']=="xml")
           {

           echo "<form action=\"index.php?op=editclient&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<div>";
           echo "ID: <b>$postid</b><br/>";
           echo "Пароль: <br/>";
           echo "<input name=\"passc\" maxlength=\"250\" value=\"$passw_db\" title=\"Text\"/><br/>";
           echo "E-mail: <br/>";
           echo "<input name=\"email\" maxlength=\"250\" value=\"$email_db\" title=\"Text\"/><br/>";
           echo "Сайт: <br/>";
           echo "<input name=\"site\" maxlength=\"250\" value=\"$site_db\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "ID: <b>$postid</b><br/>";
           echo "Пароль: <br/>";
           echo "</small><input name=\"passc".$ref."\" value=\"$passw_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "E-mail: <br/>";
           echo "</small><input name=\"email".$ref."\" value=\"$email_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "Сайт: <br/>";
           echo "</small><input name=\"site".$ref."\" value=\"$site_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=editclient&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"passc\" value=\"$(passc".$ref.")\"/>";
           echo "<postfield name=\"email\" value=\"$(email".$ref.")\"/>";
           echo "<postfield name=\"site\" value=\"$(site".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           if ($_SESSION['wap']!="xml") {echo "---<br/>";}
           echo $div["end"];
           include ("../footer.php");
           exit();
           }
           else
           {
           @mysql_query("UPDATE `clients` SET `psss`='$passc',`email`='$email',`site`='$site' WHERE (`id`='$postid')");
           echo "Данные Клиента успешно изменены!<br/>";
           echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
           }
    break;

    case "clientop":
    if (empty($go))
           {
           $q_msg = mysql_query("select * from `clients` where (`id`='$postid');");
           $row_msg=mysql_fetch_array($q_msg);
           $msg_db=$row_msg['site'];
                      if ($_SESSION['wap']=="xml")
           {
           echo "ID: <b>$id</b><br/>";
           echo "Сайт: <b>$msg_db</b><br/>";
           echo "<form action=\"index.php?op=clientop&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<div>";
           echo "+Сколько: <br/>";
           echo "<input name=\"balans\" maxlength=\"250\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "ID: <b>$id</b><br/>";
           echo "Сайт: <b>$msg_db</b><br/>";
           echo "+Сколько: <br/>";
           echo "</small><input name=\"balans".$ref."\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=clientop&amp;go=edit&amp;postid=$postid&amp;".session_name()."=".session_id()."&amp;go=post\" method=\"post\">";
           echo "<postfield name=\"balans\" value=\"$(balans".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           if ($_SESSION['wap']!="xml") {echo "---<br/>";}
           echo $div["end"];
           include ("../footer.php");
           exit();
           }
           else
           {
           @mysql_query("UPDATE `clients` SET `balans`=`balans`+'$balans' WHERE (`id`='$postid')");
           echo "Баланс клиента изменен на <b>$balans</b>$$!<br/>";
           echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
           }
    break;




    case "delclient":
    echo $div["ten"];
    @mysql_query("delete from `clients` where `id`='$id'");
    echo "Клиент удален!<br/>";
    echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;




    case "perevoda":

$file_name = "../history/all.log"; //file with links
$sim=10; //how much links on page
if(!isset($_GET['p']))$p=0; else $p = $_GET['p'];
$file=file($file_name);
$all=count($file);
$obsum = $all - $p * $sim;
$nasum = $obsum - $sim;
$end='0';
echo "Дата || Откуда || Куда || Сколько <br/>";
for($i=$obsum; $i>$nasum; $i--)
{
if(!isset($file[$i])) {$end='1';} else {$file[$i]=str_replace("\n","<br/>",$file[$i]);
$read.=$file[$i]; }

}
if($end=='1') $read.="<br/>";
$read=str_replace("&","&amp;",$read);//$read=iconv("Windows-1251", "UTF-8", $read); echo $read;
$echo .="---";
$echo .= '<br/><a href="'.$PHP_SELF.'?'.session_name().'='.session_id().'&amp;p='.($p+1).'&amp;id='.$id.'&amp;op=perevoda">След</a>';$echo .= ' ';
$echo .= '<br/><a href="'.$PHP_SELF.'?'.session_name().'='.session_id().'&amp;p='.($p-1).'&amp;id='.$id.'&amp;op=perevoda">Пред</a>';
echo $read;
echo $echo;
echo $div["div"];
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;



    case "logs":
    if (empty($id))
    {
           if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"index.php?op=logs&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "ID: <br/>";
           echo "<input name=\"id\" maxlength=\"250\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "ID: <br/>";
           echo "</small><input name=\"id".$ref."\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=logs&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"id\" value=\"$(id".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }

    }
    else
    {
    $file_name = "../logs/$id.log"; //file with links
$sim=10; //how much links on page
if(!isset($_GET['p']))$p=0; else $p = $_GET['p'];
$file=file($file_name);
$all=count($file);
$obsum = $all - $p * $sim;
$nasum = $obsum - $sim;
$end='0';
for($i=$obsum; $i>$nasum; $i--)
{
if(!isset($file[$i])) {$end='1';} else {$file[$i]=str_replace("\n","<br/>",$file[$i]);
$read.=$file[$i]; }

}
if($end=='1') $read.="<br/>";
$read=str_replace("&","&amp;",$read);//$read=iconv("Windows-1251", "UTF-8", $read); echo $read;
$echo .="---";
$echo .= '<br/><a href="'.$PHP_SELF.'?'.session_name().'='.session_id().'&amp;p='.($p+1).'&amp;id='.$id.'&amp;op=logs">След</a>';$echo .= ' ';
$echo .= '<br/><a href="'.$PHP_SELF.'?'.session_name().'='.session_id().'&amp;p='.($p-1).'&amp;id='.$id.'&amp;op=logs">Пред</a>';
echo $read;
echo $echo;
}
echo $div["div"];
echo "[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;

    case "stats":
    echo $div["div"];
    echo "<b>Дата</b> - Опсосов | Всего<br/>";
$arr = mysql_query("select * from `stats`");
$qi = mysql_query("select * from `stats` order by `id` desc;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет статы !!!";
           }
           else
           {
while($row=mysql_fetch_array($qi))
{
echo "<b>".$row['data']."</b> -
".$row['OP']." |
".$row['ALL']."<br/>";
}
}
echo "<br/>[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;
    case "about":
    if (empty($go))
           {
                      if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"index.php?op=about&amp;go=go&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "ID: <br/>";
           echo "<input name=\"id\" maxlength=\"250\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "ID: <br/>";
           echo "</small><input name=\"id".$ref."\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"index.php?op=about&amp;go=go&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"id\" value=\"$(id".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           if ($_SESSION['wap']!="xml") {echo "---<br/>";}
           echo $div["end"];
           include ("../footer.php");
           exit();
           }
           else
           {
           echo $div["div"];
           $qi = mysql_query("select * from `uzvers` where `id`='$id';");
           if (mysql_affected_rows()==0)
           {
           echo "Нет такого ID !!!";
           }
           else
           {
$row=mysql_fetch_array($qi);
echo "<b>".$row['ID']."</b> <br/>
Логин: ".$row['log']." <br/>
Пароль: ".$row['psss']." <br/>
WMZ: ".$row['wm']." <br/>
Мыло: ".$row['email']." <br/>
Сайт: ".$row['site']." <br/>
ICQ: ".$row['icq']." <br/>
Баланс ".$row['allmonth']." <br/>";
}
}
echo "<br/>[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
break;
case "sitehelp":
echo $div["ten"];
if(empty($startan)) $startan = 0;
$startan=intval($startan);
if($startan<0) $startan=0; $num_msgs_an=20;
$arr = mysql_query("select * from `uzvers` where `help`='1'");
$qi = mysql_query("select * from `uzvers` where `help`='1' order by `allmonth` desc limit $startan,$num_msgs_an;;");
           if (mysql_affected_rows()==0)
           {
           echo "Нет сайтов!";
           }
           else
           {
while($row=mysql_fetch_array($qi))
{
echo "".$row['id']." | ".$row['wm']." |
<a href=\"".$row['site']."\">".$row['site']."</a> ".$row['allmonth']."   <a href=\"index.php?op=opl&amp;postid=".$row['id']."&amp;".session_name()."=".session_id()."\">опл</a> <a href=\"index.php?op=delsite&amp;id=".$row['id']."&amp;".session_name()."=".session_id()."\">удл</a><br/>";
}
           }
$i = @mysql_num_rows($arr);
if($startan!=0)
echo "<a href=\"index.php?op=sitehelp&amp;".session_name()."=".session_id()."&amp;startan=".($startan-$num_msgs_an)."\">".htmlspecialchars("<<--")."</a>] ";
if($i>$startan+$num_msgs_an)
echo "[<a href=\"index.php?op=sitehelp&amp;".session_name()."=".session_id()."&amp;startan=".($startan+$num_msgs_an)."\">".htmlspecialchars("-->>")."</a>";;
    echo "<br/>[!]";echo "<a href=\"index.php?".session_name()."=".session_id()."\">АдминПанель</a><br/>";
    break;
}

echo $div["end"];
include ("../footer.php");
?>