Page 1 of 1

eNews

Posted: Sun Nov 30, 2003 5:32 pm
by William
Im trying to create a new poster for a friend with flat file. I have done it all it edits .ect only rpoblem is that is adds array at the bottema dn tere is no arraysb anywhere and it posts the one table and nothing else insetad of showing the old... here is the codes:

eNews.php:

Code: Select all

<html>
<head>
<title>eNews - by: TheNetherRealm - Web Design</title>
<style type="text/css">
body {color: #00CC00; background-color: #000000; scrollbar-face-color: #149507; scrollbar-highlight-color: #000000; scrollbar-3dlight-color: #000000; scrollbar-darkshadow-color: #000000; scrollbar-shadow-color: #000000; scrollbar-arrow-color: #000000; scrollbar-track-color: #149507;}
.form { border-top: #00CC00 1px solid; border-right: #00CC00 1px solid; border-left: #00CC00 1px solid; border-bottom: #00CC00 1px solid; color: #00CC00; background: #000000;}
.button { border-top: #00CC00 0px solid; border-right: #00CC00 0px solid; border-left: #00CC00 0px solid; border-bottom: #00CC00 0px solid; color: #00CC00; background: #000000; }
</style>
</head>
<body>
<form method="post" action="adddb.php" name="form">
<table cellpadding="0" cellspacing="0" border="0" bordercolor="#FFFFFF" width="600" align="center">
<tr>
	<td width="500" colspan="2">Thank you for using eNews by: TheNetherRealm - Web Design. Fill out the forms below. Please remember you can NOT add any links to the pages with out using HTML. Thank You.</td>
</tr>
<tr>
	<td width="100"><br /><br />Title:</td>
	<td width="300"><br /><br /><input type="text" name="title" size="65" maxlength="100" class="form" /></td>
</tr>
<tr>
	<td width="100">Post by:</td>
	<td width="300"><input type="text" name="by" size="65" maxlength="100" value="hybrid-soldier" class="form" /></td>
</tr>
<tr>
	<td width="100">Poster's Email:</td>
	<td width="300"><input type="text" name="email" size="65" maxlength="100" value="hybrid_dj@hotmail.com" class="form" /></td>
</tr>
<tr>
	<td width="100" valign="top">Body:</td>
	<td width="300"><textarea name="body" cols="50" rows="10" class="form"></textarea></td>
</tr>
<tr>
	<th colspan="2"><input type="submit" name="submit" value="Add Post!" class="button" /></th>
</tr>
</table>
<BR /><BR />
<table cellpadding="0" cellspacing="0" border="0" bordercolor="#FFFFFF" width="700" align="center">
<tr>
<td><Center>eNews - by: TheNetherRealm - Web Design. This is for: Hybrid-Junky ONLY.</Center></td>
</tr>
</table>
</form>
</body>
</html>
adddb.php:

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>
<pre>
".$body."
</pre>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=".$email." class=post>".$by."</a></font></td>
</tr>
</table>


$filecontent" ); 
      fclose( $fp );
   } 

header( "location: db.php" );
?>
db.php:

Code: Select all

<table width=75% border=0>
<tr> 
<td><font color=00FF00>BREAKING THE HABIT....NEXT SINGLE</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<p>
<font color=000000>
Today during the LP chat Chester said himself that Breaking the habit will be the next single. This is 
a quote from the chat - 
</p>
<p align=center>
CHAZrocks - What is your next single? Did you know 
Lars was going to come on stage and chase you around? Is it true you never 
sleep? And hi, LP rocks.
</p>
<p align=center>
Chester - Yes i rarely sleep. No i didn't know 
Lars was going to do that. The next single is Breaking the habit.</p>
<p>
You all may not know Mike Shinodas words saying 
that BTH will never be a single, in this case Warner brothers got to choose.
</p>
<p align=center>The video shoot will be in December!<img src="http://hs.c-monkey.net/logo.gif" width="300" height="92"></font>
</p>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>


<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>LP Up For Song Of The Year!!</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Somewhere I Belong is nominated 
for Song Of The Year for Launch's 2003 Music Awards. 
<p>
Here are the rest of the nominees:<br>
In Da Club - 50 Cent<br>
Crazy In Love - Beyonce<br>
Bring Me To Life - Evanescence<br>
Get Busy - Sean Paul </p>
<p>
You can vote for LP here:&nbsp;&nbsp;[<a href=http://home.php>Launch.com</a>]
</p>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>


<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Joe Hahns movie idea</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
<img src=0312890729.M.jpg name=newsimage width=92 height=140 hspace=5 vspace=5 border=0 align=right id=newsimage>
Hahn got the right to a favourite book of his called "King Rat" he has 1 year to make the scripts and get organized for movie filming. On tuesday on MOJO radio am 730 Brad and Joe were being interviewed on loveline. By request i could record the tape onto the my computer and upload it for a free download.
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>


<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>WATCH FROM THE INSIDE</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
<h2>It's on the videos page!</h2>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>


<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>From The Inside Download</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
You can *legally* download LP's new video <a href=http://www.7digitalmedia.com/downloads/linkin/location.asp>HERE</a> for about $2.00 
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>


<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Live in Texas Player</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Brand new player from the one and only Linkin Park<br /><a href=http://www.bandbuilder.com/lptexas/index.php?ref_code=D30503>Click Here</a>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>


<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Videos</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Check Out the videos page. If you have a request for a video e-mail me and I will Upload it.
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>


<p>&nbsp;</p>
<table width=75% border=0>
<tr> 
<td><font color=00FF00>Back And Better Than Ever</font></td>
</tr>
<tr> 
<td bgcolor=00CC00>
<font color=000000>
Hybrid Soldier Is Back!!! E-mail your comments 
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=mailto:hybrid_dj@hotmail.com class=post>hybrid-soldier</a></font></td>
</tr>
</table>
-Viper

SOLVED!

Posted: Sun Nov 30, 2003 6:20 pm
by William
Heys its solved eaverything stays the same way all the files! EXCEPT! adddb.php here is the code for all the people that havr the same problem:

Code: Select all

<?php
if ( $title == "" || $by == "" || $email == "" || $body == "" ) { 
      Print "We are sorry, You did not fill in all fields."; 
   } Else { 
	  $file = "db.php";
	  $filecontent = file_get_contents($file);
      $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>
<pre>
".$body."
</pre>
</font>
</td>
</tr>
<tr> 
<td align=right bgcolor=00CC00>&nbsp;<font color=000000>Posted 
by&nbsp;&nbsp;<a href=".$email." class=post>".$by."</a></font></td>
</tr>
</table>" );
fwrite( $fp, $filecontent);
      fclose( $fp );
   } 

header( "location: db.php" );
?>
To be honest i have NEVER heard of file_get_contents() o well good luck :-)

Posted: Sun Nov 30, 2003 7:09 pm
by d3ad1ysp0rk
next time, try editing out the HTML that you know wouldn't give you problems, and just paste the code like

Code: Select all

code..

<--some html-->

code..
so it's not 500 pages long ;)

LOL

Posted: Mon Dec 01, 2003 3:43 pm
by William
Haha nice :-) And im finished with it well im not but it works and does alot more then the soul purpose that it was made for :-) http://eNews.thenetherrealm.com

-Viper