View Single Post
  #7 (permalink)  
Old 09-12-2008, 03:08 AM
invision2 invision2 is offline
Registered User
 
Join Date: Sep 2008
Posts: 3
Hi,

I've tried to add .ZIP file with all the files, but think I'm too new to do so

login.php
PHP Code:
<?php
require_once("../config/Sentry.php");

$sentry = new Sentry();
if (
$_POST['user'] != '')
{
    echo
"<center>Username submitted</center><br>";
    
$sentry->checkLogin($HTTP_POST_VARS['user'],$HTTP_POST_VARS['pass'],4,'welcome.php','failed.php');
}
if(
$_POST['pass'] != '')
{
    echo
"<center>Password entered</center><br>";
}
if(
$_POST['pass'] == '')
{
    echo
"<center>Password is not yet entered</center><br>";
}
if(
$_POST['user'] == '')
{
    echo
"<center>No username submitted by form</center><br>";
}

if (
$_GET['action'] == 'logout')
{
    if (
$sentry->logout())
    {
        echo
'<center>You have been logged out</center><br>';
    }
    else
        echo
'<center>No need to log out, you were never logged in</center><br>';
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="25%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000066">
  <tr>
    <td align="center" bgcolor="#000066"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Login</strong></font></td>
  </tr>
  <tr>
    <td bordercolor="#FFFFFF">
    <form name="form1" method="post" action="login.php">
        <p>&nbsp;User:<input type="text" name="user"></p>
        <p>&nbsp;Pass:<input type="password" name="pass">
        </font></p>
        <p align="center"><input type="submit" name="Submit2" value="Submit"></p>
      </form>
        <div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="login.php?action=logout">Logout</a>&nbsp;</font></div>
    </td>
  </tr>
</table>
</body>
</html>
welcome.php
PHP Code:
<?php
require_once('../config/Sentry.php');
$theSentry = new Sentry();
if (!
$theSentry->checkLogin(2) ){ header("Location: login.php"); die(); }
?>
<html>
<head>
<title>Welcome</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
Welcome to the admin area
</body>
</html>
Firstly, I don't think a session is being created.
Reply With Quote