Can't Login to Website's Admin

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tim_razo
Forum Newbie
Posts: 5
Joined: Mon Nov 02, 2009 3:55 pm

Can't Login to Website's Admin

Post by tim_razo »

This is my problem:

I've taken over a php real estate website that I need to get up and running on my Intermedia server. I received a sql dump with the website which I imported (with no problems) to the phpMyAdmin database. The only thing I have changed is the globals (ip address username and password) and a couple links on the home page. I can tell the website is reading the database because it has all of the correct posts up on the search page and listings page and there are no errors. - http://64.78.29.151/search

The only thing that I haven't been able to get to work is the website's admin login. It won't allow any of the user to login to update the posts. I think it may have something to do with charset of the database and the encryption of the passwords. I've run into this exact same problem before but at the time I had a php programmer working on the site. The problem is I don't know where to start. Can someone help me with this???

I've been scouring the internet and forums for help, so any help or suggestions would be very much appreciated.
Thanks very much in advance!!

Tim
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Can't Login to Website's Admin

Post by John Cartwright »

Needle in a haystack without seeing the relevant code.
tim_razo
Forum Newbie
Posts: 5
Joined: Mon Nov 02, 2009 3:55 pm

Re: Can't Login to Website's Admin

Post by tim_razo »

Ok cool, what code would you like to see?? Like the login.php, database.php, globals.php, or database screen shots?
tim_razo
Forum Newbie
Posts: 5
Joined: Mon Nov 02, 2009 3:55 pm

Re: Can't Login to Website's Admin

Post by tim_razo »

Also I forgot to mention that the site is working perfectly on it's current server.

I think that it has more to do with the database charset of the passwords since it's been dumped in UTF-8 Unicode (utf8), Maybe it needs to be in another character set in order to work properly. Has anyone dealt with anything like this before?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Can't Login to Website's Admin

Post by John Cartwright »

Lets start by taking a look at login.php

Secondly, it might be helpful to see a dump of your users table (only structure).
tim_razo
Forum Newbie
Posts: 5
Joined: Mon Nov 02, 2009 3:55 pm

Re: Can't Login to Website's Admin

Post by tim_razo »

Awesome thanks...
Here is the login code:

<?

####################################
#
# login.php
#
# Logs the user into the system.
#
####################################

include_once("includes/library.php");

foreach($_REQUEST as $key => $value) { $$key = $value; }

$query = "SELECT * FROM manage_admins WHERE username='$username' AND password=PASSWORD('$password')";
$result = mysql_query($query);

if ($row = mysql_fetch_array($result)) {

foreach($row as $key => $value) { $$key = $value; }

$_SESSION['session_user_id'] = $id;
$_SESSION['session_fullname'] = $name;
$_SESSION['session_access_levels'] = $access_levels;
$_SESSION['session_logged_in'] = true;

success("Login successful.");
header("Location: admin.php");
exit;
}
else {

failure("Username and password incorrect.");
header("Location: index.php");
exit;

}



?>

and here is the sql_dump of the user tables:

Table structure for table `manage_admins`
--

CREATE TABLE `manage_admins` (
`id` smallint(6) unsigned NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`username` varchar(255) NOT NULL default '',
`password` varchar(255) NOT NULL default '',
`access_levels` varchar(255) NOT NULL default '',
`sort_order` smallint(6) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;

--
-- Dumping data for table `manage_admins`
--

INSERT INTO `manage_admins` (`id`, `name`, `username`, `password`, `access_levels`, `sort_order`) VALUES (1, 'Stanton Street Administrator', 'admin', '*17D31B99FC95444535A00A29375E8AF83D984E2', 'All', -1),
(3, 'Two Ton', 'majestic', '*BA868D9C5E8A52C7E34545865D1DEBBEE42E9', '5 7 8', 0),
(4, 'Majestic Realtors Administrator', 'administrator', '*6DF84F06534534538018EC1FF9BF5EB82BD22D', 'All', 0),
(5, 'Denise N. Joseph', 'dnjoseph', '*D7FE8E1B890345345523DDA5F54391F0', 'All', 0);
tim_razo
Forum Newbie
Posts: 5
Joined: Mon Nov 02, 2009 3:55 pm

Re: Can't Login to Website's Admin

Post by tim_razo »

Anyone?
Post Reply