hello: i use this CMS tutorial Part 5 .
i made it work. when i open login.php,input username,pass,it go to welcome to admin area.
then i made some change. i want use that sentry code to my website access multiple pages, different users depend on group, login themself pages.
this is i made change login.php code:
<?php
require_once("../includes/Sentry.php");
$sentry = new Sentry();
if ($HTTP_POST_VARS['user'] != '){
switch($HTTP_POST_VARS['thegroup']){
case 1:
$sentry->checkLogin($HTTP_POST_VARS['user'],$HTTP_POST_VARS['pass'],1,'welcome.php','failed.php');break;
case 2:
$sentry->checkLogin($HTTP_POST_VARS['user'],$HTTP_POST_VARS['pass'],2,'welcome2.php','failed.php');break;
case 3:
$sentry->checkLogin($HTTP_POST_VARS['user'],$HTTP_POST_VARS['pass'],3,'welcome3.php','failed.php');break;
}
}
elseif($HTTP_POST_VARS['enabled']=0){
?>
<script language="javascript">
alert("i am sorry, you are no allow login!");window.location.href="login.php";
</script>
<?php
}
?>
<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">
<br/><br/><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><br>
User:
<input type="text" name="user">
</font></p>
<br/><br/><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> Pass:
<input type="password" name="pass">
</font></p>
<p align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="submit" name="Submit2" value="Submit">
</font></p>
</form>
<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="login.php?action=logout">Logout</a> </font></div>
</td>
</tr>
</table>
</body>
</html>
_____________
welcome.php
<?php
require_once('../includes/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>
__________________
welcome2.php
<?php
require_once('../includes/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>
Law Firm INTRANET page
</body>
</html>
_________________
welcome3.php
<?php
require_once('../includes/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 user area
</body>
</html>
_______________
when i try input username,pass, it does not go to any welcome pages,always stay at login.php page
does anyone can help me?
thanks lots of