PHP: Checking Session State on Secondary Pages
<p>I am working with a PHP Login System from <a href="http://tutorialzine.com/2009/10/cool-login-system-php-jquery/" rel="nofollow">http://tutorialzine.com/2009/10/cool-login-system-php-jquery/</a> Just to give you a quick overview, I believe the tutorial sets up the variable in the following manner:</p>

<pre><code>&lt;?php
define('INCLUDE_CHECK',true);
require 'connect.php';
require 'functions.php';
// Those two files can be included only if INCLUDE_CHECK is defined

session_name('tzLogin');
// Starting the session

session_set_cookie_params(1*7*24*60*60);
// Making the cookie live for 1 weeks

session_start();
if($_SESSION['id'] &amp;&amp; !isset($_COOKIE['tzRemember']) &amp;&amp; !$_SESSION['rememberMe'])

..........
</code></pre>

<p>So far so good, except that I cannot carry over the session variables from the Main Login page to subsequent pages (which contain restricted content). Here is the basic code that I intend to place at the start of each restricted content page </p>

<pre><code>&lt;?php
session_name('tzLogin');
session_set_cookie_params(1*7*24*60*60);
session_start();
    if($_SESSION['id'])  &lt;-- I believe I need more code here (incldue the cookie)
{
//If all is well, I want the script to proceed and display the HTML content below.
}
else 
{
header("Location: MainLogin.html");
or die;
//redirects user to the main login page.
}
?&gt;
</code></pre>

<p>As you can see, I am a total novice, but any help would be greatly appreciated. As of now, my restricted content pages keep getting redirected to the homepage even when I am properly logged in. Hence I suspect, the SESSION state is not being carried over. Thanks again!</p>
