billybober09
New Member
I'm trying to create a very simple login in php. All i want to do is,register a session called user if the login is successful and direct the user to an inner page. in that inner page i have a include file which should check if the user session is created or notif created -> authorize userif not created -> redirect to login again. But still I couldnt get this up and running. below is my codelogin.php \[code\] session_start(); global $user; if (($_POST['Submit'])){ $login = $_POST['login']; $password = $_POST['password']; if ((do_login($login, encrypt_password($password))) > 0){ $_SESSION['user'] = $login; header('Location: home/dashboard.php'); } else{ // load login again } }\[/code\]and in my dashboard.php page this is how I'm checking it (and this part i have in another file called 'authentication.inc')\[code\]<?php session_start(); // If if (!isset($_SESSION['user'])) { // User is not logged in, so send user away. header("Location:/login"); die(); }?>\[/code\]updated ::when I do an echo $_SESSION['user'], I'm expecting to see login name ($login) of the user which i done get :C Am I missing something here... thanks in advancecheerssameera