the user enters his username ($name) and his password ($pw). usernames and passwords are stored in pw.txt.
this is the code i've written, and i don't get why it doesn't work. any help would be nice. thanks!
<?php
function redirect($URL)
{
echo "<script language='javascript'>";//
echo "function redirect(url){" ;
echo "document.location.href=url;}";
echo "redirect($URL)";
echo "</script>";
}
$pwfile = file("pw.txt");
$records = count($pwfile);
for ($i=0; $i<$records; $i++){
$line = explode( ";", $pwfile[$i] );
if(($name==$line[0])&&($pw==$line[1])){
echo "welcome, $name";
exit;
}
}
if($i=$records){
redirect("'error.php'");
exit;
}
?>