I'm not sure what it is you want to do but maybe this could help.
<?php
if (($_POST[pass]=="pass") and ($_POST[user]=="user"))
{
session_start();
$_SESSION['auth']=1;
header ("Location:page1.php");
}
else
{
header ("Location:logon.php?badlogin=2");
}
?>
$_SESSION
<?php
session_start();
if ($_SESSION['auth'] ==1)
{ header("Location:page1.php"); }
?>