I am having issues with my PHP logout script I have the below code:
<?php
session_start();
//redirect function
function returnheader($location){
$returnheader = header("location: $location");
return $returnheader;
}
$connection = mysql_connect("localhost","username","password") OR die(mysql_error());
$db_select = mysql_select_db("database",$connection) OR die(mysql_error());
// destroy cookies and sessions
setcookie("userloggedin", "");
$username = "";
session_destroy();
//redirect
returnheader("index.php");
?>
I keep getting the below error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'loginuser'@'localhost' (using password: YES) in logout.php on line 10
Access denied for user 'loginuser'@'localhost' (using password: YES)
can anyone help I am new to php and may of bitten off more than i can chew :)