...

View Full Version : Writing PHP



stophon4
04-20-2004, 12:06 AM
I have php page that writes to a php page, except the variables aren't writing, is there something I need to do?

Heres the php source:


fputs($file, '<table class="post"><tr><td>');
fputs($file, '<hr>');
fputs($file, $_POST['Name']); fputs($file,'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
fputs($file, $time);
fputs($file, '<HR>');
fputs($file, '<center>');
fputs($file, $_POST['comments']);
fputs($file, '<br>');
fputs($file, '<font color="CDCDCD" size=2>');
fputs($file, $IP);
fputs($file, '</font><hr><hr>');
fputs($file, '</td></tr></table>');
fputs($file, $newline);
fputs($file, "<?php ");
fputs($file, $newline);
fputs($file, '$IPP = getenv (REMOTE_ADDR)');
fputs($file, $newline);
fputs($file, "if($IPP=='12.202.20.222' || $IPP=='213.235.131.26' || $IPP=='194.228.174.157'){ ");
fputs($file, $newline);
fputs($file, "<form action='gb.php' method='post'><input type='Submit' Name='delete$lines' Value='Delete Post Above'></form> }");
fputs($file, $newline);
fputs($file, "?>");


It writes back as a variable :confused:

sad69
04-20-2004, 01:50 AM
Can you give us some sample output? Like what is happening, and what's not exactly?

I don't like to copy+paste code and play around with it.. I'd prefer to have it all laid out in front of me before I consider trying to answer the question... but maybe that's just me..

Sadiq.

sidney
04-20-2004, 02:26 AM
$var in ' ' eg '$var' should be taken as $var not its value

you could also try escaping the $ with \ ie \$

eg
$IPP="test";
echo"\$IPP"; should output $IPP

missing-score
04-20-2004, 09:52 AM
Also, Im assuming you have, but I dont see that you have opened the file... If not look at http://www.php.net/fopen. To open the file you need the fopen function.

stophon4
04-20-2004, 12:56 PM
Yes it does have fopen. What it does is output a guestbook post. I just need to have a deleting part for the admin...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum