Hi all,

I tried Kevin's sessions tutorial and had a play around with my own file, thus:
PHP Code:
<?php // index.php 
session_start();
include_once 
'./inc/db.inc';
 
$uid = isset($_POST['EMail']) ? $_POST['EMail'] : $_SESSION['EMail']; 
$pwd = isset($_POST['Password']) ? $_POST['Password'] : $_SESSION['Password'];
 
if(!isset(
$_SESSION['EMail'])) { 
$_SESSION['EMail'] = ''

 
if(!isset(
$_POST['SUBMITFORM'])) { 
?> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>...</title>
FORM GOES HERE:
<FORM METHOD="POST" NAME="Login" AUTOCOMPLETE="off" action="<?=$_SERVER['PHP_SELF']?>">

<table width="200" height="122" border="0" cellpadding="0">
<tr>
    <tr>
        <td valign="middle" align="right" class="mediumblack">EMail&nbsp;</td>

        <td width="65%" class="forminput"><INPUT TYPE="text" class="forminput" NAME="EMail" size="20" maxlength="35" /></td>

   </tr>

   <tr>
       <td valign="middle" align="right" class="mediumblack">Password&nbsp;</td>

       <td class="forminput"><INPUT TYPE="password" class="forminput" NAME="Password" size="20" maxlength="20" /></td>

   </tr>

    <tr>
        <td><br></td>
        <td align="center">
        <input type="checkbox" name="autologin" value="Y">Automatic login<br>&nbsp;<a href="#">What is this?</a></td>

    </tr>

    <tr>
        <td><br></td>
        <td valign="bottom" align="center" height="18"> 
        <!-- <input type="image" src="img/go.gif" border="0"> -->
        <INPUT name="SUBMITFORM" TYPE="submit" VALUE="Login">                     
        </td>

        </tr>

        <tr align="center"> 

        <td height="18" colspan="2" valign="bottom"><a href="#" title="Forgot Password">Forgot your password?</a></td>

        </tr>

        <tr align="center"> 
        <td height="18" colspan="2" valign="bottom"><a aref="join.php" title="Join Here">Not a Member yet?</a></td>
        </tr>

</table>
</FORM>

</html>
<?php
}
else { 
$_SESSION['EMail'] = (string) $_POST['EMail']; 
$_SESSION['Password'] = (string) $_POST['Password']; 


dbConnect("pa"); 
$sql "SELECT * FROM members WHERE 
       mEMail = '
$EMail' AND mPassword = PASSWORD('$Password')"
$result mysql_query($sql); 

if (!
$result) { 
 
error('A database error occurred while checking your '
       
'login details.\\nIfhis error persists, please '
       
'contact [email]you@example.com[/email].'); 
}
 
if (
mysql_num_rows($result) == 0) { 
 unset(
$_SESSION['EMail']); 
 
?> 
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
   "[url=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]"> 
 <html xmlns="[url=http://www.w3.org/1999/xhtml]http://www.w3.org/1999/xhtml[/url]"> 
 <head> 
 <title> Access Denied </title> 
 <meta http-equiv="Content-Type" 
   content="text/html; charset=iso-8859-1" /> 
 </head> 
 <body> 
 <h1> Access Denied </h1> 
 <p>Your user ID or password is incorrect, or you are not a 
    registered user on this site. To try logging in again, click 
    <a href="<?=$_SERVER['PHP_SELF']?>">here</a>. To register for instant 
    access, click <a href="join.php">here</a>.</p> 
 </body> 
 </html> 
 <?php 
 
exit; 
}
?>
However, at the bottom of the page, it keeps printing the 'Access Denied' part.

Any ideas on what I am doing wrong?

Thanks.

Mak