use session create member log in wih mysql—continue


Sandy | Full stack Web developer

The Code for the Members’ Section of the Website Checks for Valid Users

members_only.php here is the code:

<?php
session_start();

echo ‘<h1>Members only</h1>’;

// check session variable

if (isset($_SESSION[‘valid_user’]))
{
echo ‘<p>You are logged in as ‘.$_SESSION[‘valid_user’].'</p>’;
echo ‘<p>Members only content goes here</p>’;
}
else
{
echo ‘<p>You are not logged in.</p>’;
echo ‘<p>Only logged in members may see this page.</p>’;
}

echo ‘<a href=”authmain.php”>Back to main page</a>’;
?>

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s