Re: PHP login script?
- From: "fable" <johnfable@xxxxxxxxxxx>
- Date: 29 Sep 2005 14:47:38 -0700
session_start() should be first, many other problems:
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$logincheck=mysql_result($result,$i,"login");
$passcheck=mysql_result($result,$i,"pass");
$level=mysql_result($result,$i,"level");
}
This is going to leave you with the vaules of $id, $logincheck,
$passcheck, and $level with the vaules of the last entry in your db,
instead of this you need a db query more like, SELECT * FROM contacts
WHERE login='$login' AND WHERE pass="$pass"
Then check to see if there are any rows, if there are then that
username/password pair is valid.
Also here...
f(($logincheck == "$login") || ($passcheck == "$pass") || ($level !==
"userq") || ($login !== "") || ($pass !== "")){
|| are or's, you want &&, I think, where you say ($login !== "") would
let anyone see the protected content. Those should also be !=
This is a bit of a debacle, you should forget everythign I just said
and take a tutorial....
This one would do the job, http://llimllib.f2o.org/LoginTutorial.html
.
- References:
- PHP login script?
- From: dan
- PHP login script?
- Prev by Date: Re: PHP login script?
- Next by Date: Re: noob can't even make a function work right :-(
- Previous by thread: Re: PHP login script?
- Next by thread: PHP login/Pasword?
- Index(es):