Hi everyone
I'm having quite a few problems trying to get my login script working so that it redirects the user to a page depending on what interest they have chosen. Their interests are held in a mysql database. The most anoyying thing with this is that everytime I try to login, after I submit a correct username and password, it just displays a blank page!
Here is the bit of code causing me the problem:
$count = mysql_num_rows($result);
if ($count > 0)
{
echo "Welcome $username<br>";
update_login_table($username);
login_page();
$login = "yes";
}
else
{
echo "Your username or password is invalid. Please try again.";
}
function login_page()
{
$username = $_POST[UserName];
$host="localhost";
$connect = mysql_connect($host,"","")
or die ("Couldn't connect to server.");
$db = mysql_select_db("liveweb", $connect)
or die ("Couldn't connect to database.");
$sql1 = "SELECT InterestsID FROM customer_interests WHERE UserName = '$username'";
$query1 = mysql_query ($sql1)
or die ("Couldn't execute query.".mysql_error());
//foreach ($HTTP_POST_VARS as $key => $value)
$row = mysql_fetch_array($query1);
extract($row);
$interest = array[InterestID];
if ($interest == 1);
{
header ("Location: mylivedrama.php");
}
else if ($interest == 5);
{
header ("Location: mylivejhc.php");
}
else
{
header ("Location: whatson.php");
}
return;
}
I've been trying to get this to work for a couple of days now and now have no idea what I'm doing wrong.
Any suggestions anyone?
Thanks in advance.