PHP -- using session variables / reloading the page (logging in/out)
<p>I am building a login system and have a mysql query that checks the name and password and puts out a page saying 'logged' if they match.</p>

<p>what I want to know is how i can use session variables to see if the user is logged in and then redirect them to a different page if they are.  </p>

<p>do i have to set all session varaibles in the same php code snippet as the 'session_start();'
or can i do some like this on the same page</p>

<pre><code>&lt;?php session_start(); ?&gt;

html here

&lt;?php $_SESSION['test'] = blah; ?&gt;
</code></pre>

<p>if i call it another page do i have to have the session_start(); there too?  or can i just $_REQUEST any session variable from any page one the session starts?</p>
