sessions
Posted: Thu Aug 11, 2011 6:13 am
Hi guys,
I have 2 headers to include: header_Secure.php and header.php.
What I am trying to do is when session exist include header_Secure.php and when session does not exist include header.php.
Here is my code:
<?php
// headers change between logged in and not logged in
session_start();
$header = '';
// Be sure to check that this manager SESSION value is in fact in the database
$managerID = $_SESSION["id"];
$manager = $_SESSION["manager"];
$password = $_SESSION["password"];
include 'register/includes/connect_to_mysql.php';
$sql = mysql_query("SELECT * FROM members WHERE id ='$managerID' AND Email ='$manager' AND Password='$password' LIMIT 1");
$existCount = mysql_num_rows($sql); // count the row nums
if ($existCount == 0)
{
$header = ' <?php include_once "includes/header.php";?> ';
}
else
{
$header = ' <?php include_once "includes/header_Secure.php";?> ';
};
?>
But the problem I am having is that it is not picking any headers, I am not sure since I am new to php if I am able to use php inside php like $header = ' <?php include_once "includes/header.php";?> ';
Youssef
I have 2 headers to include: header_Secure.php and header.php.
What I am trying to do is when session exist include header_Secure.php and when session does not exist include header.php.
Here is my code:
<?php
// headers change between logged in and not logged in
session_start();
$header = '';
// Be sure to check that this manager SESSION value is in fact in the database
$managerID = $_SESSION["id"];
$manager = $_SESSION["manager"];
$password = $_SESSION["password"];
include 'register/includes/connect_to_mysql.php';
$sql = mysql_query("SELECT * FROM members WHERE id ='$managerID' AND Email ='$manager' AND Password='$password' LIMIT 1");
$existCount = mysql_num_rows($sql); // count the row nums
if ($existCount == 0)
{
$header = ' <?php include_once "includes/header.php";?> ';
}
else
{
$header = ' <?php include_once "includes/header_Secure.php";?> ';
};
?>
But the problem I am having is that it is not picking any headers, I am not sure since I am new to php if I am able to use php inside php like $header = ' <?php include_once "includes/header.php";?> ';
Youssef