Page 1 of 1
2 questions.
Posted: Wed Nov 26, 2003 11:12 pm
by William
Code:
Code: Select all
<?php
if ( $title == "" || $by == "" || $email == "" || $body == "" ) {
Print "We are sorry, You did not fill in all fields.";
} Else {
$filename = "db.php";
$fp = fopen( $filename, "w" ) or die("We are sorry, You can not add the post. Please contact TheNetherRealm - Web Design. For more information.");
fwrite( $fp, "
<table width="75%" border="0">
<tr>
<td><font color="#00FF00">$title</font></td>
</tr>
<tr>
<td bgcolor="#00CC00"><p><font color="#000000">$body</font></p></td>
</tr>
<tr>
<td align="right" bgcolor="#00CC00"><font color="#FFFFFF"> </font><font color="#000000">Posted
by</font> <font color="#000000"><a href="$email" class="post">$by</a></font></td>
</tr>
</table>include("db.php");
" );
fclose( $fp );
}
?>
Does anyone know how that include i can make it include the text in it? I know there is a command like ."". or somthing just dont know what it is :'( (I am a newb as you can tell sigh...) && is it possible to put a php.ini in your cgi-bin and it will over-ride the servers and if not how can i?
Thanks - William
Posted: Wed Nov 26, 2003 11:31 pm
by infolock
although this isn't gonna do anything.. you should probably call the include above all your other code, and then call whatever variables it is out of it that you want where the include is currently.
edit, so you would want to do it like this :
Code: Select all
<?php
include("db.php");
if ( $title == "" || $by == "" || $email == "" || $body == "" ) {
Print "We are sorry, You did not fill in all fields.";
} Else {
$filename = "db.php";
$fp = fopen( $filename, "w" ) or die("We are sorry, You can not add the post. Please contact TheNetherRealm - Web Design. For more information.");
fwrite( $fp, "
<table width="75%" border="0">
<tr>
<td><font color="#00FF00">$title</font></td>
</tr>
<tr>
<td bgcolor="#00CC00"><p><font color="#000000">$body</font></p></td>
</tr>
<tr>
<td align="right" bgcolor="#00CC00"><font color="#FFFFFF"> </font><font color="#000000">Posted
by</font> <font color="#000000"><a href="$email" class="post">$by</a></font></td>
</tr>
</table>".$some_var_from_db_php_here);
fclose( $fp );
}
?>
Cant.
Posted: Wed Nov 26, 2003 11:38 pm
by William
db.php is nothing but HTML. lol. No varibles to it hmm... so any other ideas? Thanks
Ok i figured it out!
Posted: Wed Nov 26, 2003 11:46 pm
by William
when yuor right it i should just pur r+ sorry. Found on another post guess i really payed attentions huh lol and thanks alot

Posted: Wed Nov 26, 2003 11:46 pm
by lc
try this:
Code: Select all
<?php
if ( $title == "" || $by == "" || $email == "" || $body == "" ) {
Print "We are sorry, You did not fill in all fields.";
} Else {
$filename = "db.php";
$filecontent = file("db.php");
$fp = fopen( $filename, "w+" ) or die("We are sorry, You can not add the post. Please contact TheNetherRealm - Web Design. For more information.");
fwrite( $fp, "
<table width="75%" border="0">
<tr>
<td><font color="#00FF00">$title</font></td>
</tr>
<tr>
<td bgcolor="#00CC00"><p><font color="#000000">$body</font></p></td>
</tr>
<tr>
<td align="right" bgcolor="#00CC00"><font color="#FFFFFF"> </font><font color="#000000">Posted
by</font> <font color="#000000"><a href="$email" class="post">$by</a></font></td>
</tr>
</table>$filecontent
" );
fclose( $fp );
}
?>
R+ or W+?
Posted: Wed Nov 26, 2003 11:48 pm
by William
Wow im confused i guesss il try both ways

amazing my book didnt show all of this hmm
Posted: Wed Nov 26, 2003 11:50 pm
by lc
Both ways should work. You prolly got the r+ command from this thread
http://www.devnetwork.net/forums/viewtopic.php?t=14963 as well where we talked about it

R+ wont work and either will W+
Posted: Thu Nov 27, 2003 12:03 am
by William
I don't get I I tryed it both ways here is the code.
Code: Select all
<?php
if ( $title == "" || $by == "" || $email == "" || $body == "" ) {
Print "We are sorry, You did not fill in all fields.";
} Else {
$filename = "db.php";
$fp = fopen( $filename, "r+" ) or die("We are sorry, You can not add the post. Please contact TheNetherRealm - Web Design. For more information.");
fwrite( $fp, "
<table width="75%" border="0">
<tr>
<td><font color="#00FF00">$title</font></td>
</tr>
<tr>
<td bgcolor="#00CC00"><p><font color="#000000">$body</font></p></td>
</tr>
<tr>
<td align="right" bgcolor="#00CC00"><font color="#FFFFFF"> </font><font color="#000000">Posted
by</font> <font color="#000000"><a href="$email" class="post">$by</a></font></td>
</tr>
</table>
" );
fclose( $fp );
}
?>