Hey there , after some help on the board i found what the problem was with the authentication script i was using as a kind board member said it was due to the scope of the variables in the function , when i passed the variables into the function aswell it got rid of the error but complained about header already sent so i sneakily changed the include at the top to a "require" in the function , that dident manage to fool it and it now complains of the headers already being sent again , any ideas?
<?
// authenticate using form variables
$status = authenticate($formuser,$formpass);
// if user/pass combination is correct
if ($status == 1)
{
// initiate a session
session_start();
// register some session variables
session_register("SESSION");
// including the username
session_register("SESSION_UNAME");
$SESSION_UNAME = $user;
// redirect to protected page
header("Location: /search.html");
exit();
}
else
// user/pass check failed
{
// redirect to error page
header("Location: /error.htm");
exit();
}
// authenticate username/password against a database
// returns: 0 if username and password is incorrect
// 1 if username and password are correct
function authenticate($user, $pass)
{
require 'dbcnf.php';
// check login and password
// connect and execute query
$db = mysql_connect($dbadd,$dbusr,$dbpwd) or die("Could not connect... ");
mysql_select_db($dbname,$db);
$query = "SELECT userid from usertable WHERE (username = '$user') AND (password = '$pass')";
$result = mysql_query($query, $db) or die ("Error in query: $query. " . mysql_error());
// if row exists -> user/pass combination is correct
if (mysql_num_rows($result) == 1)
{
return 1;
}
// user/pass combination is wrong
else
{
return 0;
}
}
?>