The problem is on my login page everything works just fine but the problem here is when i successfully login the username doest show up at the main page.
include ('connect.php');
if (($_SERVER['REQUEST_METHOD'] == 'POST') && (!empty($_POST['action']))):
$usernameLog = $_POST['usernameLog'];
$passwordLog = $_POST['passwordLog'];
$valid = true;
if($valid == TRUE){
include('connect.php');
$usernameLog = mysql_real_escape_string($usernameLog);
$passwordLog = mysql_real_escape_string(md5($passwordLog));
$sql = mysql_query("SELECT * FROM register WHERE username = '$usernameLog' AND passconf = '$passwordLog'");
if(mysql_num_rows($sql) > 0){
//if true then lets go to the logged in page
session_start();
$_SESSION['logat'] = "da";
header('location: BlogWorld.php');
I am not sure what's going wrong. Please help
//codes sesssion for the main page ie when user is successfully logged in
include('connect.php');
// Start session
session_start();
// Check if user is logged and existing session
if(isset($_SESSION['username'])) {
include ("connect.php");
// Content for user logged
echo "Welcome ".$username." :) - <a href='logout_Blog.php'>Logout</a>";
} else {
// Redirecting to login page
Header("Location: ./");