View file moder/index.php

File size: 37.81Kb
<?
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 "<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["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>";
echo $div["end"];
if (empty($op)) $op="index";
switch ($op) {
  case "index":
    echo $div["ten"];
    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?op=ticketplus&amp;".session_name()."=".session_id()."\">Тикетс</a><br/>";
    echo "<img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?op=allsite&amp;".session_name()."=".session_id()."\">Все сайты</a><br/>";
    echo "<img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?op=siteready&amp;".session_name()."=".session_id()."\">Готовые к выплатам</a><br/>";
    echo "<img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?op=sitehelp&amp;".session_name()."=".session_id()."\">Просят выплат</a><br/>";
    echo "<img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?op=logs&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/>";
    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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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/><img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?op=news&amp;mod=add&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/>";
    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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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> <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/><img src=\"../pics/st.gif\" alt=\"*\"/>";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/><img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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']." <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><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/><img src=\"../pics/st.gif\" alt=\"*\"/>";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']." |
<a href=\"".$row['site']."\">".$row['site']."</a> ".$row['allmonth']." <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/><img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";echo "E-mail: <br/>";
           echo "<input name=\"email\" maxlength=\"250\" value=\"$msg_db\" title=\"Text\"/><br/>";
           echo "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";echo "E-mail: <br/>";
           echo "</small><input name=\"email".$ref."\" value=\"$msg_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<img src=\"../pics/st.gif\" alt=\"*\"/>";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/><img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?op=client&amp;mod=add&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/>";
    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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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 "<img src=\"../pics/st.gif\" alt=\"*\"/>";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/><img src=\"../pics/st.gif\" alt=\"*\"/>";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/><img src=\"../pics/st.gif\" alt=\"*\"/>";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=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/><img src=\"../pics/st.gif\" alt=\"*\"/>";echo "<a href=\"index.php?".session_name()."=".session_id()."\">Модерка</a><br/>";
    break;
}

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