View file modules/admin/top_counters.php

File size: 4.16Kb
<?php
########################################
##	           WAP-ENGINE             ##
########################################
##                                    ##
##  Автор : CHUMA (Токарев Владимир)  ##
##  e-mail : [email protected]     ##
##  WAP : http://wap-engine.ru        ##
##                                    ##
########################################
##         ВЫ НЕ ИМЕЕТЕ ПРАВО         ##
##        ИЗМЕНЯТЬ КОД СКРИПТА        ##
##  ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ!  ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
$title_page = 'Настройка счетчиков';
$m_polozhenie = 'В админке';
####################
if($_GET['act'] == 'set')
 {
  if(isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw && $status == '1')
   {
    $counters = $_POST['counters'];
    $counters = stripslashes(trim($counters));
    $counters = str_replace('"','"',$counters);
    $counters = str_replace("\'","'",$counters);
    $fp = fopen('../../data/top_counters.txt','w');
    fputs($fp,$counters);
    fclose($fp);
    
    $counters_g = $_POST['counters_g'];
    $counters_g = stripslashes(trim($counters_g));
    $counters_g = str_replace('"','"',$counters_g);
    $counters_g = str_replace("\'","'",$counters_g);
    $fp_g = fopen('../../data/top_counters_g.txt','w');
    fputs($fp_g,$counters_g);
    fclose($fp_g);
    
    $date = date("d.m.Y / H:i:s", time() + ($sdvigclock*3600));
    $adm_log_f = @file('../../data/adm_log.php');
    $adm_log_count = count($adm_log_f) - 2;
    $mes_to_adm_log = "$login|$date|Изменил счетчики сайта\r\n";
    for($i=2; $i < $adm_log_count; $i++)
     {
      $mes_to_adm_log .= $adm_log_f[$i];
     }
    $mes_to_adm_log = trim($mes_to_adm_log);
      
    $adm_log_file = fopen('../../data/adm_log.php','w');
    flock ($adm_log_file,LOCK_EX);
    fputs($adm_log_file,"<?php\r\n/*\r\n$mes_to_adm_log\r\n*/\r\n?>");
    fflush ($adm_log_file);
    flock ($adm_log_file,LOCK_UN);
    fclose($adm_log_file);

    header ('location: top_counters.php?set=1&'.session_name().'='.session_id().'');
   } 
    else
   {
    include '../../themes/'.$themes.'.php';
    echo'<p class="err">Вы не авторизованы!!! Войдите в личный кабинет.<br /></p>';
    echo'<p><a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a><br /></p>';
    include '../../templates/foot.php';
   }
 }
####################
$file = '../../data/top_counters.txt';
$file_g = '../../data/top_counters_g.txt';
$counters = @file_get_contents($file);
$counters_g = @file_get_contents($file_g);

if(empty($_GET['act']))
 {
  include '../../themes/'.$themes.'.php';
  
  if(isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw && $status == '1')
   {
echo'<p class="modul_name"align="center">Настройки счетчиков</p>';

if($_GET['set'] == '1')
     {
      echo'<p class="b">Счетчики настроены.</p>';
     }    
    echo'<form method="post" action="top_counters.php?act=set&amp;'.session_name().'='.session_id().'">';
    
    echo'<p class="a">HTML код на главной<br /></p><p class="b"><textarea rows="4" cols="15" name="counters_g">'.$counters_g.'</textarea><br /></p>';
    
    echo'<p class="a">HTML код на остальных страницах<br /></p><p class="b"><textarea rows="4" cols="15" name="counters">'.$counters.'</textarea><br />';
    
    echo'<input value="Сохранить" name="do" type="submit" /></form><br /></p>';
    echo'<p><a href="index.php?'.session_name().'='.session_id().'">В админку</a></p>';
   }
    else
   {
    echo'<p class="err">Вы не авторизованы!!! Войдите в личный кабинет.<br /></p>';
   }
  echo'<p><a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a><br /></p>';
  include '../../templates/foot.php';
 }
####################
?>