i'm started to use webmatrix and now iam using php starter site template.
in this template you cant login. i searched all codes than i found it doesnt create session. maybe it creates but dont pass to other pages.
if there is user(logon.php):
if ($statement->num_rows == 1)
{
$statement->bind_result($uid,$uname);
$statement->fetch();
$_SESSION['userid']=$uid;
$_SESSION['username']=$uname;
echo $_SESSION['username']; // yes its printing username
header ("Location: index.php");
}
check(header.php):
if (logged_on())
{
echo '<li><a href="/logoff.php">Sign out</a></li>' . "\n";
}
logged_on function:
function logged_on()
{
return isset($_SESSION['userid']); //empty
}
Just write
session_start();
on the top of the page
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.