Hi,
i've written a login-script. It works fine, but just on one point there's still a problem.
You have to fill in your name in a textfield called $naam and your e-mailadress. When the button 'Register' is pressed (action=registreren), the script loads a file with all the users. Then it normally has to check if $naam wasn't already taken.
This is my code:
<?
$naam_bezet = false;
$userslist_array = file("textfiles/userslist.txt");
$aantal_users = count($userslist_array);
switch($action){
case "":
include('register.htm');
case "registreren":{
if ($naam != '' and $mailadres != '') {
//checking if $naam wasn't already taken
for ($i = 0; $i < $aantal_users - 1; $i++) {
$username = $userslist_array[$i];
if ($username == $naam) {
$naam_bezet = true;
break;
}
}
if($naam_bezet == false) {
//now the script writes the new user in the userslist.txt-file, that part of the script works, so I will not post it here
}
}
else {
echo "This name is already taken";
}
}
break;
}
?>
For some reason, the script seems not to change $naam_bezet in true, even if you fill in a name that is in the userlist. Maybe it always sets $naam_bezet back on false for some reason?
I don't understand why it doesn't work.
Can anyone help me?
Thanks a lot,
Herr Vredy