I am having a user update files using php. My problem is i get \ infront of characters that would normally need them in a string like " or '. I am not sure how to stop these.
is there another way i can do the following:
<?php
include 'header2.ht';
error_reporting(0);
$read = fopen("CPMAIN.TXT", "r"
or die("<br /><font face=\"Verdana\">Sorry! There is no access to this file directly. You must follow a link. <br /><br />Please click your
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
;
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$cpd = "";
while(!feof($read)){
$cpd .= fread($read, 10000); // reduce number to save server load
}
fclose($read);
error_reporting(0);
$read = fopen("CEMAIN.TXT", "r"
or die("<br /><font face=\"Verdana\">Sorry! There is no access to this file directly. You must follow a link. <br /><br />Please click your
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
;
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$ced = "";
while(!feof($read)){
$ced .= fread($read, 10000); // reduce number to save server load
}
fclose($read);
error_reporting(0);
$read = fopen("NEWS.TXT", "r"
or die("<br /><font face=\"Verdana\">Sorry! There is no access to this file directly. You must follow a link. <br /><br />Please click your
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
;
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$newd = "";
while(!feof($read)){
$newd .= fread($read, 10000); // reduce number to save server load
}
fclose($read);
//FUNCTION BEGINS HERE##################
if(isset($_POST["cp"]))
{
error_reporting(0);
$read = fopen("CPMAIN.TXT", "w"
or die("<br /><font face=\"Verdana\">Sorry! There is no access to this file directly. You must follow a link. <br /><br />Please click your
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
;
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$cpd = $_POST['cp'];
fwrite($read, $cpd);
fclose($read);
error_reporting(0);
$read = fopen("CEMAIN.TXT", "w"
or die("<br /><font face=\"Verdana\">Sorry! There is no access to this file directly. You must follow a link. <br /><br />Please click your
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
;
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$ced = $_POST['ce'];
fwrite($read, $ced);
fclose($read);
error_reporting(0);
$read = fopen("NEWS.TXT", "w"
or die("<br /><font face=\"Verdana\">Sorry! There is no access to this file directly. You must follow a link. <br /><br />Please click your
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
;
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$newd = $_POST['news'];
fwrite($read, $newd);
fclose($read);
}
?>
<p class="midTitle">Update Main Page</p>
<form name="update" method="post" action="<?php print("up_main.php?"
?>">
<LABEL for="cp"><p class="main2">Cost Planning</p></LABEL>
<textarea cols="65" rows="10" name="cp" id="cp">
<?php echo $cpd ?>
</textarea>
<LABEL for="ce"><p class="main2">Cost Engineering</p></LABEL>
<textarea cols="65" rows="10" name="ce" id="ce">
<?php echo $ced ?>
</textarea>
<LABEL for="news"><p class="main2">Latest News:</p></LABEL>
<textarea cols="65" rows="8" name="news" id="news">
<?php echo $newd ?>
</textarea>
<p class="lup2"><INPUT type="submit" value="Update"> <INPUT type="reset"></p>
</form>
<?php
include 'bottom.ht';
?>
THANKS!
is there another way i can do the following:
<?php
include 'header2.ht';
error_reporting(0);
$read = fopen("CPMAIN.TXT", "r"
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$cpd = "";
while(!feof($read)){
$cpd .= fread($read, 10000); // reduce number to save server load
}
fclose($read);
error_reporting(0);
$read = fopen("CEMAIN.TXT", "r"
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$ced = "";
while(!feof($read)){
$ced .= fread($read, 10000); // reduce number to save server load
}
fclose($read);
error_reporting(0);
$read = fopen("NEWS.TXT", "r"
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$newd = "";
while(!feof($read)){
$newd .= fread($read, 10000); // reduce number to save server load
}
fclose($read);
//FUNCTION BEGINS HERE##################
if(isset($_POST["cp"]))
{
error_reporting(0);
$read = fopen("CPMAIN.TXT", "w"
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$cpd = $_POST['cp'];
fwrite($read, $cpd);
fclose($read);
error_reporting(0);
$read = fopen("CEMAIN.TXT", "w"
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$ced = $_POST['ce'];
fwrite($read, $ced);
fclose($read);
error_reporting(0);
$read = fopen("NEWS.TXT", "w"
browser's back button. </font><br><br><a href=\" src=\" alt=\"miracle 2\" border=\"0\"></a>"
// let's turn errors back on so we can debug if necessary
error_reporting(1);
$newd = $_POST['news'];
fwrite($read, $newd);
fclose($read);
}
?>
<p class="midTitle">Update Main Page</p>
<form name="update" method="post" action="<?php print("up_main.php?"
<LABEL for="cp"><p class="main2">Cost Planning</p></LABEL>
<textarea cols="65" rows="10" name="cp" id="cp">
<?php echo $cpd ?>
</textarea>
<LABEL for="ce"><p class="main2">Cost Engineering</p></LABEL>
<textarea cols="65" rows="10" name="ce" id="ce">
<?php echo $ced ?>
</textarea>
<LABEL for="news"><p class="main2">Latest News:</p></LABEL>
<textarea cols="65" rows="8" name="news" id="news">
<?php echo $newd ?>
</textarea>
<p class="lup2"><INPUT type="submit" value="Update"> <INPUT type="reset"></p>
</form>
<?php
include 'bottom.ht';
?>
THANKS!