I'm making a script for website staff members to login and basically edit the entire site. Fortunatley for you, all I need help with is part of my login script.
It goes something like this:
<?php
session_start();
if ($_POST['username'] == 'username' and
$_POST['password'] == 'password' or
$_POST['username'] == username2 and
$_POST[password'] == password2)
$_SESSION['authorized'] = true;
?>
<?php if (!$_SESSION['authorized']): ?>
<!-- display login page -->
<?php else: ?>
<!-- display page when logged in -->
<?php endif; ?>
Somewhere in the logged in page I have <?php echo("Welcome back, $username!") ?>, but for some reason when I go to a seperate page in the staff control panel, the session will lose memory of the username and password so it will only say "Welcome back, !"
I have a hunch this is caused because of my using $_POST instead of something else. If any of you could cure my scripts alzheimers, I don't know how I could repay you. Thanks