Just from a quick glance at the posted code... and not sure if it's your actual/only problem or not, but the for() loops appear to be infinite, since they lack ++ after the last $i's. Other notes:
$savefile = "plug.db.php";
$newfile = fopen($savefile,"w ");
That part seemed unnecessary. The script can just check to see if it exists if it only needs to read from it, or create it automatically when it comes time to write to it.
In any case, it probably wouldn't hurt to remove that space and change "w " to "w".
The inconsistent quoting of variables also seems sloppy. While not a problem by itself, sloppiness in coding often ends up equalling a security hole for end users.
for ($i = 0; $i < $maxdata; $i )
I'm guessing that last $i should be $i++, if you're trying to walk through an array...
... otherwise, that part would probably just keep printing $line forever.
Not to mention, is all of that work, just to append one line to an existing file? If so, I don't see why it's assigning its own contents to a new variable, adding one line, then completely rewriting everything to itself.
I'd have a look at fopen() on the PHP site and decide if r+, a, or a+ would be better than the w flag as it's being used.
There are also other for() loops in the code that look to be infinite. See this page for more info on for() loops.
Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.