spider
08-16-2002, 06:13 AM
im trying to develope a program, and the login wont log me in. the script generates a .dat file, when user registers. no problem there, everything in the .dat file... username and password, but when i go an log in under that username and password, it gives me the message that, that username or password isnt correct.
here the code for the login form:
<table><tr>
<form method='post' name='login' action='loginin.php'>
<td>User ID:</td>
</tr>
<td><input name='id' type='text'></td>
</tr>
<td>Password:</td>
</tr>
<td><input name='pass' type='password'></td>
</tr>
<td><input type='submit' name='submit' value='Login'></form></td>
</tr></table>
here the code for the loginin.php
<?
session_start();
session_register("user");
$user = "$id";
include("config.php");
$file = "/member/$user.pass.dat";
if (file_exists($file))
{
include("/member/$user.pass.dat");
if (($id == $user) and ($pass == $password))
{
header("SET-COOKIE: logedin=$id; expires=Monday, 07-Jan-2005 00:00:00 GMT;");
echo "<meta http-equiv='Refresh' content='2; URL=$site_url/stats.php'>";
}
else
{
echo "<center>You Entered the wrong username or password</center>";
echo "<center><PRE>
<form method='post' name='login' action='loginin.php'>
Login
User ID: <input name='id' type='text'>
Password: <input name='pass' type='password'></td></tr>
<input type='submit' name='submit'><input type='Reset'></form>";
}
}
else
{
echo "<center>You Entered the wrong username or password</center>";
echo "<center><PRE>
<form method='post' name='login' action='loginin.php'>
Login
User ID: <input name='id' type='text'>
Password: <input name='pass' type='password'></td></tr>
<input type='submit' name='submit'><input type='Reset'></form>";
}
?>
If i take out one else statment, i get this error:
Parse error: parse error in loginin.php on line 30
thats why i leave it in...
the $user.pass.dat file has this in it:
<? $user='admin'; $password='k4tm4nn'; ?>
and in the members folder, the $user is same as admin
like this:
admin.pass.dat
any suggestions?
here the code for the login form:
<table><tr>
<form method='post' name='login' action='loginin.php'>
<td>User ID:</td>
</tr>
<td><input name='id' type='text'></td>
</tr>
<td>Password:</td>
</tr>
<td><input name='pass' type='password'></td>
</tr>
<td><input type='submit' name='submit' value='Login'></form></td>
</tr></table>
here the code for the loginin.php
<?
session_start();
session_register("user");
$user = "$id";
include("config.php");
$file = "/member/$user.pass.dat";
if (file_exists($file))
{
include("/member/$user.pass.dat");
if (($id == $user) and ($pass == $password))
{
header("SET-COOKIE: logedin=$id; expires=Monday, 07-Jan-2005 00:00:00 GMT;");
echo "<meta http-equiv='Refresh' content='2; URL=$site_url/stats.php'>";
}
else
{
echo "<center>You Entered the wrong username or password</center>";
echo "<center><PRE>
<form method='post' name='login' action='loginin.php'>
Login
User ID: <input name='id' type='text'>
Password: <input name='pass' type='password'></td></tr>
<input type='submit' name='submit'><input type='Reset'></form>";
}
}
else
{
echo "<center>You Entered the wrong username or password</center>";
echo "<center><PRE>
<form method='post' name='login' action='loginin.php'>
Login
User ID: <input name='id' type='text'>
Password: <input name='pass' type='password'></td></tr>
<input type='submit' name='submit'><input type='Reset'></form>";
}
?>
If i take out one else statment, i get this error:
Parse error: parse error in loginin.php on line 30
thats why i leave it in...
the $user.pass.dat file has this in it:
<? $user='admin'; $password='k4tm4nn'; ?>
and in the members folder, the $user is same as admin
like this:
admin.pass.dat
any suggestions?