java001
02-20-2012, 01:39 PM
I have a problem - I made a code that allows me to read files in a textarea.
Now what I see in the text area is basically the source of the file :
http://img96.imageshack.us/img96/5720/dgdsgk.jpg (http://imageshack.us/photo/my-images/96/dgdsgk.jpg/)
And I want people to edit only their text, the problem is that people can see also the code. What I want it, is to look like this: so people could see everytext in the file that they uploaded in it's size, and decoration.
http://img269.imageshack.us/img269/6625/outputge.jpg (http://imageshack.us/photo/my-images/269/outputge.jpg/)
How can I do this ? I can't seem to understand this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<?php
//file to read
$file = "C:\wamp\www\New Folder\cpl.php";
// file open
$fo = fopen("$file", "r") or die("Could not find '$file'!");
//read the file
$fr = fread($fo, filesize($file)) or die("Could not read '$file'!");
//close the file
$fc = fclose($fo) ;
?>
<center>
<textarea cols='118' name="txtbox" rows='15' class='textarea'><?php echo $fr; ?></textarea>
</center>
</body>
</html>
Now what I see in the text area is basically the source of the file :
http://img96.imageshack.us/img96/5720/dgdsgk.jpg (http://imageshack.us/photo/my-images/96/dgdsgk.jpg/)
And I want people to edit only their text, the problem is that people can see also the code. What I want it, is to look like this: so people could see everytext in the file that they uploaded in it's size, and decoration.
http://img269.imageshack.us/img269/6625/outputge.jpg (http://imageshack.us/photo/my-images/269/outputge.jpg/)
How can I do this ? I can't seem to understand this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<?php
//file to read
$file = "C:\wamp\www\New Folder\cpl.php";
// file open
$fo = fopen("$file", "r") or die("Could not find '$file'!");
//read the file
$fr = fread($fo, filesize($file)) or die("Could not read '$file'!");
//close the file
$fc = fclose($fo) ;
?>
<center>
<textarea cols='118' name="txtbox" rows='15' class='textarea'><?php echo $fr; ?></textarea>
</center>
</body>
</html>