View file admin/admin.php

File size: 4.7Kb
<?php
##############################
##	     WAP-GUEST  	    ##
##############################
##						    ##
## Автор : CHUMA			##
## e-mail : [email protected]		##
## WAP : http://wapeng.info ##
## ICQ : 13-14-11			##
##                          ##
## Модификатор: Jeri        ##
## e-mail: [email protected] ##
## wap: http://Jeri.h2m.ru 	##
##                          ##
##############################
##  ВЫ НЕ ИМЕЕТЕ ПРАВО      ##
##  ИЗМЕНЯТЬ КОД СКРИПТА    ##
##  ДЛЯ ДАЛЬНЕЙШЕГО         ##
##  РАСПРОСТРАНЕНИЯ         ##
##############################
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);

session_name("SES");
session_start();
include ("../config.php");

if ($_GET[act]=="ans")
{
include ("../themes/$themes.php");
if ($_SESSION['login']==$nickadmina && md5($_SESSION['pass'])==$passadmina)
 {
  echo "<p>ответ для $_GET[for]</p>";
  echo "<form action=\"admin.php?act=send&amp;str=$_GET[str]&amp;page=$_GET[page]\" method=\"post\">
        <p><textarea rows=\"4\" cols=\"15\" name=\"otv\"></textarea>";
  echo "<br /><br />";
  if (!empty($_GET[to]))
   {
    echo "<input type=\"radio\" name=\"mail\" value=\"$_GET[to]\">ответ на $_GET[to]<br/><br/>";
   }
  echo "<input type=\"submit\" value=\"ответить\" /></p></form>";
  echo "<p><a href=\"../index.php\">В гостевую</a></p>";
}
else
{
echo "<p>ошибка авторизации<br/></p>";
}
include("templates/foot.php");
}

if($_GET[act]=="send")
{
 if ($_SESSION['login']==$nickadmina && md5($_SESSION['pass'])==$passadmina)
  {
    $otv = $_POST[otv];
    $otv = stripslashes($otv);
    $otv = htmlspecialchars($otv);
    # Начало Смайлики ;-)
    $sm_dir = opendir("../smiles");
    while ($file = readdir($sm_dir))
     {
      if($file != "Thumbs.db" && $file != ".." && $file != ".")
       {
        $sm_array[] = "<img src=\"../smiles/$file\" alt=\"\" />";
       }
     }
    closedir ($sm_dir);
    sort($sm_array);
    $sm_dir1 = opendir("../smiles");
    while ($file1 = readdir($sm_dir1))
     {
      if($file1 != "Thumbs.db" && $file1 != ".." && $file1 != ".")
       {
        $file1 = explode(".", $file1);
        $sm_array1[] = ":$file1[0]:";
       }
     }
    sort($sm_array1);
    closedir ($sm_dir1);
    # Конец Смайлики ;-)
    $otv = str_replace($sm_array1,$sm_array,$otv);
    $otv = str_replace('
', '<br/>', $otv);
    $base    = "../gb.txt";
 	$basestr = file("$base");
 	$restr   = trim($basestr[$_GET[str]]);
    $buff    = @file_get_contents($base);
    $buff    = str_replace("$restr\r\n","$restr|$otv\r\n",$buff);
    $file    = fopen("$base","w");
    flock ($file,LOCK_EX);
    fputs($file,"$buff");
    fflush ($file);
    flock ($file,LOCK_UN);
    fclose($file);

  if (!empty($_POST[mail]))
   {
    $headers  = "Content-Type: text/html; charset=utf-8\n";
    $headers .= "From: $mailadmina\nX-Mailer: PHP v.".phpversion();
    $tema     = "Ответ админа из гостевой - $home";
    $text     = "Ответ на ваше сообщение в гостевой - $home: $otv";
    mail($_POST[mail],$tema,$text,$headers);
   }
  header ("Location: ../index.php?page=$_GET[page]");
  }
   else
  {
   include ("../themes/$themes.php");
   echo "<p>ошибка авторизации<br /></p>";
include("templates/foot.php");
  }
}

if ($_GET[act]=="del")
 {
  if ($_SESSION['login']==$nickadmina && md5($_SESSION['pass'])==$passadmina)
   {
   	$basedel = "../gb.txt";
 	$basestr = file("$basedel");
 	$delstr = trim($basestr[$_GET[str]]);
    $buff = @file_get_contents($basedel);
    $buff =str_replace("$delstr\r\n","",$buff);
    $file = fopen("$basedel","w");
    flock ($file,LOCK_EX);
    fputs($file,"$buff");
    fflush ($file);
    flock ($file,LOCK_UN);
    fclose($file);
    header ("Location: ../index.php?page=$_GET[page]");
   }
    else
   {
    include ("../themes/$themes.php");
    echo "<p>ошибка авторизации<br /></p>";
include("templates/foot.php");
   }
 }

if ($_GET[act]=="clearguest")
 {
  if ($_SESSION['login']==$nickadmina && md5($_SESSION['pass'])==$passadmina)
   {
   	$basedel = "../gb.txt";
 	$basestr = file("$basedel");
 	$buff = "$basestr[0]";
    $file = fopen("$basedel","w");
    flock ($file,LOCK_EX);
    fputs($file,"$buff");
    fflush ($file);
    flock ($file,LOCK_UN);
    fclose($file);
    header ("Location: ../index.php");
   }
    else
   {
    include ("../themes/$themes.php");
    echo "<p>ошибка авторизации<br /></p>";
include("templates/foot.php");
   }
 }

?>