Ok - I think it would be better to read and write to a plain text file then trying to write a new php file for register.inc. The code looks a bit funky as well.
<?
$name = "till";
?>,newname1,newname2........
So just write a simple comma delimited file - basically what you where doing - so each of your usernames are seperated in by a comma in your text file - without trying to write new php code.
so you text file would just look like
newname1,newname2,newname3, etc etc
Then to Check if a user name already exists in that file you could use something like this:
$fp = fopen ("register.txt","r");
$row = 0;
while ($data = fgetcsv ($fp, 10000, ",")) {
if ($data[$row] == "$name") {
print "&result="Name already in use";
break;
}
$row++;
}
Well the rest of it would be the same - It's late here and I'm not sure if i got that entirely correct - but hopefully you can see the idea.
fgetcsv function can be found here:
http://www.php.net/manual/en/function.fgetcsv.phpBasically just an easy way of reading in comma seperated values (csv) from text files.
If it finds a match to the username entered by the user - then it will break and print out the result indicating it's already in use. You will have to work in some logic their, and I'm really not sure if this is the best way...