RE: [PHP] Writing & Displaying Records
| From: | Maxim Maletsky | Date: | Thu, 05 Oct 2000 06:47:37 +0000 |
| Subject: | RE: [PHP] Writing & Displaying Records | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-18706@lists.php.net to get a copy of this message | ||
You can "clone" an php file with php.
just in the same way you write a txt file, write a php file, then all these
"dangerous" characters you need to escape with a backslash,
add all the strings to a variable and then at the very moment the file is
being created srtipslashes()..
and.. here we go: you've just cloned a php script...
I pasted here a part of my class which does that.... (hope you understand
something..)
function writer($zone)
{
global $DOCUMENT_ROOT;
$html .= '\<\?'.$this->n.$this->n.'echo \'<FONT FACE="ARIAL,
HELVETICA, SANS-SERIF" SIZE="2">\';'.$this->n.$this->n;
$html .= $this->letter.$this->n.$this->n.'echo
\'</FONT></FONT>\';'.$this->n.$this->n.'\?\>';
$myFile = fopen($DOCUMENT_ROOT.$this->file.$zone.'.html',"w");
fputs($myFile, stripslashes($html));
fclose($myFile);
return true;
}
the function can be much much more complicated that the one I made, I
believe that with a little bit of luck and enthusiasm you can clone a
complicated script.
You can also use things like read file and assign, copy.. anything you want:
I am just saying that it is possible to clone with php...
-----Original Message-----
From: Andrew V. Romero [mailto:Rom33ero@pharmacy.arizona.edu]
Sent: Thursday, October 05, 2000 2:26 PM
To: php-general@lists.php.net
Subject: [PHP] Writing & Displaying Records
I have been trying to make a php file that will write the contents of an
html form to a file and this just display that data. Let me give an
example, I have a html form with just one text entry called data. The
user is going to enter a word into this form and then once they hit
submit I want the php file to write what they entered and display what
other people have entered. To do this I tried:
$wd=fopen("writedata.txt","a");
$wdata=fwrite($wd,$data);
fclose($wd);
$wd=fopen("writedata.txt","r");
$currentdata=fgets($wd,50);
echo "<br>Data Currently in File: $currentdata";
but that jams all the data entered by the various users together and I
can't figure out how to seperate it out when I am trying to display it.
I don't know if I am writing the file wrong and it is getting crammed
together or if it is the way that I am reading the file. If you know of
any tutorials that can help me, or if you would be willing to give me a
hand I would really appreciate it.
Thanks
If you want to reply personally, please remove all numbers from my
address.
--
Andrew V. Romero
Romer1999o@pharmacy.arizona.edu
Remove the #'s from my address to reply.
http://www.u.arizona.edu/~avr/
ICQ #54080914
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net