PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
prithvim
Forum Newbie
Posts: 16 Joined: Fri Apr 16, 2004 3:34 pm
Location: India
Contact:
Post
by prithvim » Fri Apr 16, 2004 6:58 pm
i have got one more problem. cant make out where the mistake is !!
here are the two scripts that i used:
Code: Select all
<html>
<head>
<title>User Login</title>
</head>
<body>
<div>
<form action="loginuser.php" method="post">
<b>UserID: </b><input type="text" name="userid" length="8" size="8"><br>
<b>Password: </b><input type="password" name="password" length="8" size="8"><br><br>
<input type="reset" value="Reset">
<input type="submit" value="Login">
</div>
</body>
</html>
and:
Code: Select all
<?php
session_start();
if($fp=fopen("$_POSTїuserid].txt","r"))
{
$check1=fgets($fp);
$check2=fgets($fp);
$name=fgets($fp);
fclose($fp);
if($check2==$_POSTїpassword])
{
$_SESSIONї'name']=$name;
print("You are now logged in as <b>$_POSTїuserid]</b>.");
}
else
{
die("Invalid password.");
}
}
else
{
die("UserID does not exist.");
}
?>
it says invalid password though i have typed the correct password !!
no matter what i change..it is not workin.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Apr 16, 2004 6:59 pm
change
Code: Select all
if($check2==$_POSTїpassword])to
Code: Select all
if($check2==$_POSTї'password'])
prithvim
Forum Newbie
Posts: 16 Joined: Fri Apr 16, 2004 3:34 pm
Location: India
Contact:
Post
by prithvim » Fri Apr 16, 2004 7:06 pm
nope it is not working.
i had already tried that.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Apr 16, 2004 7:15 pm
well.. that is an quasi-error anyway. Uhm... tried using trim($check2)?
prithvim
Forum Newbie
Posts: 16 Joined: Fri Apr 16, 2004 3:34 pm
Location: India
Contact:
Post
by prithvim » Sun Apr 18, 2004 8:19 am
but there is only the password in one line
that is the way i wrote to the text file !!
and also when i echo @check2 to the screen..it comes out exactly same as the password entered !!