Intranet Journal

Go Back   IT Management Forum > Intranet Journal

Intranet Journal The new discussion forum for Intranet Journal readers. Leave comments and questions for IJ authors. Suggest story ideas and provide feedback.

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-07-2008, 04:26 AM
leeroy leeroy is offline
Registered User
 
Join Date: Sep 2008
Posts: 3
Exclamation Content Management System login failed

i have been folowing the tutorial to a t and i have been really enjoying it but for some reason i have now been stoped dead in my tracks. i entred the folowing code into mySQL

CREATE TABLE `cmsgroups` (
`ID` int(4) unsigned NOT NULL auto_increment,
`groupname` varchar(15) default NULL,
PRIMARY KEY (`ID`)
) TYPE=MyISAM;

INSERT INTO `cmsgroups` VALUES (1,'Admin');
INSERT INTO `cmsgroups` VALUES (2,'Editors');
INSERT INTO `cmsgroups` VALUES (3,NULL);
INSERT INTO `cmsgroups` VALUES (4,NULL);
INSERT INTO `cmsgroups` VALUES (5,NULL);
INSERT INTO `cmsgroups` VALUES (6,NULL);
INSERT INTO `cmsgroups` VALUES (7,NULL);
INSERT INTO `cmsgroups` VALUES (8,NULL);
INSERT INTO `cmsgroups` VALUES (9,NULL);
INSERT INTO `cmsgroups` VALUES (10,'Anonymous');


CREATE TABLE `cmsusers` (
`ID` int(4) unsigned NOT NULL auto_increment,
`user` varchar(20) default NULL,
`pass` varchar(20) default NULL,
`thegroup` int(4) default '10',
`firstname` varchar(20) default NULL,
`surname` varchar(20) default NULL,
`enabled` int(1) default '1',
PRIMARY KEY (`ID`)
) TYPE=MyISAM;


INSERT INTO `cmsusers` VALUES (1,'admin',PASSWORD('admin'),1,'Mr','Admin',1);

so i then tried to login to view welcome.php but returned a blank page so i then created a failed.php and when i entre the username admin and password admin i am sent to the failed page i created so i assume i have entred something into mySQL wrong if someone could tell me whythis is it would be grealy apreciated

Thanks lee
Reply With Quote
  #2 (permalink)  
Old 09-07-2008, 05:00 AM
leeroy leeroy is offline
Registered User
 
Join Date: Sep 2008
Posts: 3
problem solved

problem now solved thanks to
Login form for CMS doesn't work?
Reply With Quote
  #3 (permalink)  
Old 09-09-2008, 05:35 AM
invision2 invision2 is offline
Registered User
 
Join Date: Sep 2008
Posts: 3
I'm having the same problem.
I tried PeteZ's workaround(recreate table/edit Sentry.php) but still the same error occurs.

It seems whenever I use the correct user/pass combo, I'm redirected to login.php, but if it's an incorrect combo, I'm taken to 'failed.php'.
Could this be a session issue?

Having looked into this further, I'm guessing there's an issue with 'welcome.php' that forces the user to be redirected to 'login.php':

PHP Code:
<?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>

Last edited by invision2; 09-09-2008 at 06:30 AM.
Reply With Quote
  #4 (permalink)  
Old 09-09-2008, 05:35 PM
marzar00 marzar00 is offline
Registered User
 
Join Date: Jun 2008
Posts: 22
G'day invision2,

Ok I have sent you a reply message, but I also thought of something else. This is what my index.php header looks like:
PHP Code:
require_once('../includes/sentry.php');
$theSentry = new Sentry();
if (!
$theSentry->checkLogin(2) ){ header("Location: login.php?action=priv"); die(); }
My header has an extra bit:
PHP Code:
?action=priv
Ignore this, you can delete it.

Marzar
Reply With Quote
  #5 (permalink)  
Old 09-10-2008, 02:59 AM
invision2 invision2 is offline
Registered User
 
Join Date: Sep 2008
Posts: 3
Hi,

Thanks for the reply and PM.

Yes, it sounds like modifying the script is a very good call. I'm using it right now as a good framework to start my OOP cms-based web sites.

It seems its just my 'welcome.php' that is playing up.

When I use the correct login details, it sends me back to 'login.php', but if incorrect I get sent to 'failed.php'. Any ideas?
Reply With Quote
  #6 (permalink)  
Old 09-11-2008, 11:57 PM
marzar00 marzar00 is offline
Registered User
 
Join Date: Jun 2008
Posts: 22
Hmmm...could you please post your code from the login.php and welcome.php files and I'll see what I can do for you.

Marzar
Reply With Quote
  #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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -5. The time now is 09:46 PM.





Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.0.0