Radnut
Joined: 13 Oct 2006
Posts: 1
|
Posted: 10/13/2006, 4:21 pm Post subject: Custom Login Script |
|
|
Hey, I have been baffled by this problem for the last few days and need abit of outside intervention. I am making a site but don't want to work with mysql yet. I am using sessions and storing each of the user accounts within an individual text file.
| Code: |
<?php
session_start();
$name = ($_POST['username']);
$pass = ($_POST['password']);
if($name != "")
{
$user_account = file("./accounts/" . strtolower($name) . ".txt");
for($i=0;$i<3;$i++)
{
rtrim($user_account[$i]);
}
$name = $user_account[0];
$enc_pass = $user_account[1];
$email = $user_account[2];
$pass = md5($pass);
// PROBLEM STARTS HERE, SEEMS TO SKIP THIS IF AND EXECUTES THE ELSE STATEMENT
if($pass != "" && ($pass == $enc_pass))
{
echo "You have been logged in.";
// Create the session variables etc...
}
else
{
echo "You have entered an incorrect username or password.";
}
}
else
{
echo "You have entered an incorrect username or password.";
}
?> |
It basically won't recognise the passwords. I've printed out both the user's entered password and the password from the file and they are exactly the same. But it just won't work. Any ideas? _________________ http://www.radicalnut.com |
|