this is my login page
<?
require("sys/func.php");
session_start();
if(isset($_POST[lsubmit])) {
$username = $_POST[uname];
$q = mysql_query("SELECT * FROM Users WHERE userName='$username' and password='$_POST[password]'");
$str = mysql_fetch_object($q);
if($str) {
$_SESSION['user']=$str->userName;
header("Location: index.php");
}
else {
echo "Username and password did not match";
}
}
?>
Then on index.php, I have this:
<?
require("sys/func.php");
session_start()
if(isset($_SESSION['user'])) {
echo "Logged in as $_SESSION['user']";
}
else {
echo "please login";
}
?>
It tells me
Logged in as Array
Why as Array? Then if I refresh the page, I just get "Logged in as " and nothing more.
Why is this?
PHP Version - 5.1.4
Thanks