View file www/adm/js/rename_f.php

File size: 1.22Kb
<?php
session_start();
$cms = $_SESSION['cms_2'];
echo '
<script type="text/javascript">
function hide5(){
parent.document.getElementById("renx").style.display = "none";
}

function rel(){
   parent.location.reload();
}

</script>
';
if ($_POST['ren_yes'] == 1)
{
 if ( (is_file($cms.$_POST['ren_pole']) || is_dir($cms.$_POST['ren_pole']))  && (isset($_POST['ren_ok']) && strlen($_POST['ren_ok']) >= 3) )
 {
  if (@rename($cms.$_POST['ren_pole'],$cms.$_POST['ren_ok']))
  {
   echo 'Переименовано...
   <script type="text/javascript">
   setTimeout("rel()",2000);
   </script>
   ';

  }
  else
  {
   echo 'Ошибка. Файл/папка не переименовано
    <script type="text/javascript">
   setTimeout("rel()",2000);
   </script>
   ';

  }
 }
}
else
{
echo '
<div ><input onClick="hide5()" type="submit" value="X"></div>
<div >
<form name="" action="" method="post">
<input name="ren_pole" type="hidden" value="'.$_POST['ren_pole'].'">
Переименовать '.$_POST['ren_pole'].'<br /> в <input name="ren_ok" type="text" value="'.$_POST['ren_pole'].'">
<br />
<input name="ren_yes" type="hidden" value="1">
<input type="submit" value="Да"> | <input type="button" onClick="hide5()" value="Нет">
</form></div>
';
}
?>