Hi there,
The last few days have SUCKED.
First, my free host Xoasis.com (who supported PHP4, god bless 'em) decided they'd BREAK their PHP4 support in some bizarre attempt to fit their banners in.
http://www.stevensdebate.com/
See what I'm talking about. I don't know about you guys, but IE gives me an unhandled filetype and offers to just download the file to the desktop.
So, of course, I moved.
I set up the SAME SITE, all files identical, on Spaceports at:
http://cgi-bin.spaceports.com/~debate/index.php
Now here's the REAL problem. The scripts for reading the news/team files from flatfile databases which worked PERFECTLY at Xoasis don't work at Spaceports!
No errors or anything... just nonfunction.
THE PROBLEM:
Whenever anyone loads the Index page, the tab-delimited textfile database will be opened, shoved into memory, spun around (so the last and newest item in it is displayed first on the site) and printed.
This worked on Xoasis. On Spaceports, only the first item on the database is printed! No errors, just only one item's printed.
PLEASE explain what's wrong! As this script worked perfectly before, I have no idea where to begin. If anyone could post a WORKING version, I'd be thrilled.
Here's the code:
NEWSREADING FUNCTIONS:
function ReadNews()
{
// read the data file into an array
$myfile = file("postdb.txt");
// turn the whole array upside down
$myfile = array_reverse($myfile);
// walk it, applying myfunc
array_walk($myfile, 'myfunc');
}
function myfunc($item)
{
$TheDate = date("F j, Y");
list ($PostTitle, $PosterName, $ThePost) = explode (" ", $item);
$ThePost = ereg_replace("\\'", "'", $ThePost);
$ThePost = stripslashes($ThePost);
PRINT("<p>
<table border='1' cellpadding='1' bordercolor='4B6D9D' cellspacing='0' width='400'>
<tr>
<td bgcolor='#4b6d9d'>
<center>
<b>$PostTitle - [$TheDate]</b></center>
</td>
</tr>
<tr>
<td>$ThePost <br><br>
- $PosterName</td>
</tr>
</table>
</p>");
}
THE DATABASE IT'S READING
Debate Underway! Steven Bartholomew While November seems far away, it will be here before anyone is aware. That\'s why the Stevens Debate Team has been hitting it hard and getting ready for the year.
Team Page Up Peter Yes, yes! The team page is up!
<br>
<br>Go there now by clicking on that darling little link on the sidebar and you\'ll be transported to informational bliss.
<br>
<br>Should you not be on that list (and the vast majority if you are not), just <a href=\'mailto:peter@stevensdebate.com\'>email me</a> with your name, a brief biography, and your email address, and all will be well.
<br>
<br>If you lack a Stevens Debate email, go <a href=\'http://mail.stevensdebate.com\'>get one</a>. Now.
Election Peter Dear friends,
<br>
<br>There are several wonderful perks of owning a web site. Being able to do this is the best of them.
<br>
<br>George W. Bush is the President of the United States, and I\'m miserable. It\'s not that I have some affection for Al Gore; I think he\'d be a horrid President. I\'m sad because America will see no change this year. But then again, that\'s just my take on the issue.
<br>
<br>One of my personal idols, Michael Moore, said it much better than I ever could; <a href=\"http://www.michaelmoore.com/2000_11_07.html\">see what he has to say.</a>
<br>
<br>Feel free to <a href=\"mailto:peter@stevensdebate.com\">mail</a> me with your opinions.
Thanks a million for the help. I REALLY need to get this working by Monday.
PS: Death to everyone at Xoasis. Death for breaking PHP support, and extra death for not responding to my emails.