So you log in on one page, and it takes you to the viewClients page. The login works, and takes you to viewClients, but viewClients is not recognizing my login. What have I missed?
login.php:
session_start();
$secret_word = "spinach";
if ( validate ( $_REQUEST['username'], $_REQUEST['password'] ) ) {
$_SESSION['login'] = $_REQUEST['username'].','.md5( $_REQUEST['username'].$secret_word );
header( "Location: viewClients.php" );
} else {
print "Get lost...";
}
viewClients.php:
unset ( $username );
if ( $_SESSION['login'] ) {
list ( $c_username, $cookie_hash ) = explode( ',', $_SESSION['login'] );
if ( md5( $c_username.$secret_word ) == $cookie_hash ) {
$username = $c_username;
print $username;
} else {
header ( "Location: index.php" );
}
} else {
header ( "Location: index.php" );
}
thanks!