| NamePros Regular Join Date: Mar 2006
Posts: 394
NP$: 211.38 ( Donate)
| Another simple code My code is reading the passwords from a simple file. The user and passwords are delimited by comas. Ex
user1,pass1
user2,pass2 PHP Code: <?php
$username=$_POST['username'];
$password=$_POST['password'];
$handle = fopen('/etc/php.pas',"r");
while(!feof($handle))
{
$line = fgets($handle,1024);
list($u,$p) = explode(',',$line);
$u = trim($u);
$p = trim($p);
if ($username!="")
if ($username==$u && $password==$p)
{
// just add your session cookies here and etc.
header("Location: test.html");
exit();
}
}
fclose($handle);
?> |