View file modile/adm/tema_red.php

File size: 1.24Kb
Выберите тему!
<?php
echo
'<span class="ramka">
Редактировать тему сайта.
</span><br>';
$s_tema = trim(file_get_contents('cgf/tema.txt'));


if ($_POST['s_tema'] != '')
{
 if (is_file('dis/'.$_POST['s_tema'].'/tema.html'))
 $save_tem = trim($_POST['s_tema']);
 else
 $save_tem = $cms_theme_UP;

 $fp = fopen ('cgf/tema.txt', "w+");
 fwrite ($fp, trim($save_tem));
 fclose ($fp);

 echo '
   <span class="ramka">
   Успешно!
   </span>
    <a href="/adminf.php?m='.$_GET['m'].'&id='.$_GET['id'].'">Далее</a>
   ';

}

else

{
?>
<br />

<form name="" action="" method="post">

<?php
          echo '<select size="1" name="s_tema">';

          $dir = opendir ("dis");
          while ($file = readdir ($dir))
         { if (( $file != ".") && ($file != "..") && ($file != "price.txt"))
          {
           if ($file == $s_tema)
           echo '<option selected value="'.$file.'">'.$file.'</option>';
           else
           echo '<option value="'.$file.'">'.$file.'</option>';
           }
         }
          closedir ($dir);
          echo '</select><br />';
          ?>
<input class="knopka" type="submit" value="Сохранить">
</form>

<?php
}
?>