View Full Version : Why is it doing this twice?

03-02-2003, 10:53 AM
I am making a system for the main page of my site, where admins can add a news item to the page using PHP ( like a message board. )

I have used a simple code for adding links to the page ect ( like the one on here, but when I try and post the message, it posts 2 of them, 2 of the same message.

I have checked about everything I can think of, and It doesn't seem to help. Down to this basic code below, it still posts 2 messages.

Can anyone help and tell my WHY?

$subj = rmvHTML($subject);
$pmsg = rmvHTML($message); // rmvHTML replaces < and > with &lt; and &gt;
$pmsg = toCode($message); // toCode replaces stuff like [BOLD] with <strong>

$amFile = fopen('newslog.dat','a');

fwrite($amFile,"\n\n<!-- START NEW POST -->\n<center>
<table width=\"590\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<td width=\"300\" colspan=\"300\" style=\"border:1px solid #999999; border-right:0px; padding-left:8px\" bgcolor=\"#EEEEEE\"><p id=\"form\"><img src=\"itkb/bullet1.gif\" />$subj</p></td>
<td width=\"290\" colspan=\"290\" style=\"border:1px solid #999999; border-left:0px; padding-left:8px\" bgcolor=\"#EEEEEE\" align=\"right\"><p id=\"small\">Posted By: $user<img src=\"pixel.gif\" width=\"5\" height=\"1\" /></td>
<td width=\"590\" colspan=\"590\" style=\"border:1px solid #999999; border-top:0px; padding-left:21px; padding-top:4px; padding-bottom:0px; padding-right:4px\" bgcolor=\"#FFFFFF\"><p id=\"small\">$pmsg</p>
<p id=\"small\" align=\"right\"><a class=\"nvs2\" href=\"mailto:$mail\">e-mail this person</a> | <a class=\"nvs2\" href=\"$site\">visit site</a> | <a class=\"nvs2\" href=\"$rel\">similar topics</a>
<br /><br />\n\n<!-- END POST -->");


( If you need to have a look at the layout ( i dont think that would be a problem ) then go to http://www.itoolkit.net/itk

03-02-2003, 04:45 PM
I took the script, dropped the variables and functions and it worked fine. Can I see the rest of the script?

03-02-2003, 05:17 PM
Which variables did you drop?

I have attched all the files...

03-02-2003, 10:40 PM
After looking at your script it looks like it should work as is. Dunno? I did play around a bit and switched from append to write on the line (additem.php):

$amFile = fopen('newslog.dat','w');

and it works. Don't know why, but it does.

03-03-2003, 07:03 AM
I really cant understand that!!! It works. The trouble is it destroys all the old information.

I thought I had picked this up pretty well, but now I'm really confused, like the time I forgot my name ( JUST KIDDING!!! )

Thanks anyway. If anyone else can help, plz do...


03-03-2003, 08:20 PM
Thanks for all your help. I found out the problem...

My web host is buggered and it runs everything twice!

I put


$fp = fopen('newslog.dat','a');

fwrite($fp,'Hello<br />');



and it still wrote it in twice. It also sent mail twice aswell! my friends got annoyed lol.

I am still under the refund and It also doesnt have the power I need to run my site anyway ( I need MySQL for the forum I am making ) and I found this site ( http://www.icdsoft.com ) which is REALLY deacent.


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum