I have just written a Bullettin board type thing in php. I have just one problem with it that I'm completely stuck on.
when I post a reply to a thread, it saves the timestamp with the other post info in my (flatfile) database. using this bit of script:
Code: Select all
//write to thread file
$date_now = time();
$new_thread_line = "$username||$date_now||$post_id||$message\n";
$ftd = fopen("data/$tid","a");
fwrite($ftd, $new_thread_line);
fclose($ftd);Code: Select all
$time_now = time();
echo <<<EndHtml
<tr>
<td bgcolor="#414141" valign="middle" align=left></td>
<td bgcolor="#414141" valign="middle" align=right><h2>All times are GMT. The time now is $time_now</td>
</tr>EndHtml;Even stranger is that the post is often dated 30 seconds after the page has loaded!
here is a screen shot that illustrates my point:

The main problem here is that I have another function which marks read/unread posts and threads but this is often wrong because all the times are wrong.
Surely the time() and dat functions can't be so inprecise?
If you have any suggestions/ideas/questions please post because this one has stumped me and a few others I've asked.
If you don't understand me I'll try and explain again.
Cheers
?>