Try changing this:
$check = @fopen("$referer/$phpurl/createtable.php","r");
if (!$check) {
to this:
$check = @fopen("$referer/$phpurl/createtable.php","r");
$check = 1;
if (!$check) {
This will make it think that it passed. Then see how far you can get from there. Your creating a new setup right? Because I can't say for sure what will happen in the following steps after tricking it into thinking this check worked. It's not so bad to fudge a new database as it is to kill an old one with your data in it.
Let me know what happens.
