Hi Guys,
Still having troules with the script below.
Everything works as it should exceopt for:
else
header (\"Location: index.php\");
Why won\'t this goto the index.php page...is there something wrong with the script?
Any ideas?
<?
session_start();
if ($userid && $password)
{
// if the user has just tried to log in
$db_conn = mysql_connect(\'localhost\', \'\', \'\');
mysql_select_db(\"psp\", $db_conn);
$query = \"SELECT * FROM members WHERE login_name=\'$userid\' AND password=\'$password\' AND admin=\'yes\'\";
$result = mysql_query($query, $db_conn);
if (mysql_num_rows($result) >0 )
{
// if they are in the database register the user id
$valid_user = $userid;
session_register(\"valid_user\");
$userdata = mysql_fetch_array($result);
}
}
if (session_is_registered(\"valid_user\"))
{
// logged in successfully
if ($userdata[admin] == \"yes\")
header (\"Location: membership.php\");
else
header (\"Location: index.php\");
}
else
{
if (isset($userid))
{
// if they\'ve tried and failed to log in
header (\"Location: warning.php \");
}
else
{
// they have not tried to log in yet or have logged out
header (\"Location: warning.php \");
}
}
?>