Hi there!
I'm trying to make an login page where members can login. It doesn't work yet, so I hope someone can help me out.
Here's my script:
<?php
/* Program: Login.php
* Desc: Login program for the Members Only section
*/
session_start();
include("jc.inc");
{
mysql_connect($host,$user,$password);
}
$sql = "SELECT loginName FROM Member
WHERE loginName='$_POST[fusername]'";
if ($num == 1) // login name was found
{
$sql = "SELECT loginName FROM Member
WHERE loginName='$_POST[fusername]'
AND password=md5('$_POST[fpassword]')";
$result2 = mysql_query($connection,$sql)
or die("Couldn't execute query 2.");
$num2 = mysql_num_rows($result2);
if ($num2 > 0) // password is correct
{
$_SESSION['auth']="yes";
$logname=$_POST['fusername'];
mysql_query($connection,$sql) or die("Can't execute query.");
header("Location:
http://www.centelleo.mygb.nl/");
}
else // password is not correct
{
unset($_GET['do']);
$message="The Login Name, '$_POST[fusername]'
exists, but you have not entered the
correct password! Please try again.<br>";
include("login_form.inc");
}
}
elseif ($num == 0) // login name not found
{
unset($_GET['do']);
$message = "The Login Name you entered does not
exist! Please try again.<br>";
include("login_form.inc");
}
?>
In jc.inc are my passwords and inlognames, I know they are correct.
In login_form.inc is a tabel to login.
When I go to the page, it says ""The Login Name you entered does not exist! Please try again. ", although I haven't fill in anythin yet.
When I try to login, it shows after I logged in that the page can not be displayed.
Help, what am I doing wrong?
thanks in advance,
moos