I'm using aphpkb, a open source knowledgebase script. I'm having trouble logging into the admin panel. User and password I'm typing in is correct and the script does work on another server when I tried it. Its just something with this server. I tried rinstalling it with no success. When I try to login to the admin panel I get a htaccess style login popup.
I believe the problem might be in the auth.php file.
Here's the mysql:Code:<?php $authorized = FALSE; // Initialize a variable. // Check for authentication submission. if ( (isset($_SERVER['PHP_AUTH_USER']) AND isset($_SERVER['PHP_AUTH_PW'])) ) { require_once ('kbconnect.php'); // Query the database. $query = "SELECT first_name FROM users WHERE username='{$_SERVER['PHP_AUTH_USER']}' and password=PASSWORD('{$_SERVER['PHP_AUTH_PW']}')"; $result = mysql_query ($query); $row = @mysql_fetch_array ($result); if ($row) { // If a record was returned... $authorized = TRUE; } } // If they haven't been authorized, create the pop-up window. if (!$authorized) { header('WWW-Authenticate: Basic realm="Knowledgebase"'); header('HTTP/1.0 401 Unauthorized'); // For cancellations. exit; } ?>
Here's the index.php from the admin panel:Code:# Database : `akb` # aphpkb # # Please note: the last line in this file should be edited # --------------------------------------------------------------- # # Table structure for table `articles` # CREATE TABLE articles ( FileID int(3) unsigned NOT NULL auto_increment, Title varchar(50) NOT NULL default '', Author varchar(50) NOT NULL default 'Andy Grayndler', Category varchar(50) default '', Keywords varchar(80) default NULL, Articledata longtext, Approved char(1) default 'N', Views int(10) default '0', SubmitDate timestamp(14) NOT NULL, PRIMARY KEY (FileID), KEY Keywords (Keywords) ) TYPE=MyISAM; # # Table structure for table `categories` # CREATE TABLE categories ( CatID int(3) unsigned NOT NULL auto_increment, Category varchar(50) NOT NULL default '', Approved char(1) default 'N', PRIMARY KEY (CatID) ) TYPE=MyISAM; # # Dumping data for table `categories` # INSERT INTO categories VALUES (1, 'Linux', 'Y'); INSERT INTO categories VALUES (2, 'Applications', 'Y'); INSERT INTO categories VALUES (3, 'MySQL', 'Y'); INSERT INTO categories VALUES (4, 'Debian', 'Y'); INSERT INTO categories VALUES (5, 'Ubuntu', 'Y'); INSERT INTO categories VALUES (6, 'Windows', 'Y'); INSERT INTO categories VALUES (7, 'aphpkb', 'Y'); # -------------------------------------------------------- # # Table structure for table `comments` # CREATE TABLE comments ( FileID mediumint(8) unsigned NOT NULL default '0', ParentID mediumint(8) unsigned NOT NULL default '0', Title varchar(50) NOT NULL default '', Author varchar(50) NOT NULL default '', Email varchar(50) NOT NULL default '', Articledata longtext, Approved char(1) default 'N', SubmitDate datetime NOT NULL default '0000-00-00 00:00:00', id mediumint(8) unsigned NOT NULL auto_increment, PRIMARY KEY (id), KEY FileID (FileID), KEY ParentID (ParentID) ) TYPE=MyISAM; # # Table structure for table `questions` # CREATE TABLE questions ( QuestionID mediumint(8) NOT NULL auto_increment, Question longtext NOT NULL, Name varchar(50) NOT NULL default '', Email varchar(50) NOT NULL default '', Respond char(1) NOT NULL default 'N', PRIMARY KEY (QuestionID), KEY Name (Name) ) TYPE=MyISAM; # # Table structure for table `users` # CREATE TABLE users ( user_id mediumint(8) unsigned NOT NULL auto_increment, username varchar(20) default NULL, first_name varchar(15) NOT NULL default '', last_name varchar(30) NOT NULL default '', email varchar(40) default NULL, password varchar(16) NOT NULL default '', registration_date datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (user_id), UNIQUE KEY username (username), KEY first_name (first_name), KEY last_name (last_name), KEY password (password) ) TYPE=MyISAM; # # Dumping data for table `users` # INSERT INTO users VALUES (1, 'admin', 'Andy', 'Grayndler', 'aphpkb@atmail.com', '16d7f906289d77b3', '2004-08-13 22:49:02');
All the files are located in the correct area.Code:<?php // This is the main page for the admin site. //Set Authentication for the Admin Area require_once ('../docs/auth.php'); // Set the page title and include the HTML header. $page_title = 'KB Admin - Statistics'; $title = 'Statistics'; include_once ('../includes/adminheader.html'); require_once ('../docs/kbconnect.php'); // Connect to the database // pending articles count $query = "SELECT count(*) from articles WHERE Approved = 'N'"; $result = mysql_query($query); $row = mysql_fetch_row ($result); $pendingarticles = $row[0]; // approved articles count $query = "SELECT count(*) from articles WHERE Approved = 'Y'"; $result = mysql_query($query); $row = mysql_fetch_row ($result); $approvedarticles = $row[0]; $totalarticles = $approvedarticles + $pendingarticles; // pending comments count $query = "SELECT count(*) from comments WHERE Approved = 'N'"; $result = mysql_query($query); $row = mysql_fetch_row ($result); $pendingcomments = $row[0]; // approved comments count $query = "SELECT count(*) from comments WHERE Approved = 'Y'"; $result = mysql_query($query); $row = mysql_fetch_row($result); $approvedcomments = $row[0]; $totalcomments = $approvedcomments + $pendingcomments; // pending questions count $query = "SELECT count(*) from questions WHERE Respond = 'N'"; $result = mysql_query($query); $row = mysql_fetch_row ($result); $pendingquestions = $row[0]; // pending articles count $query = "SELECT count(*) from questions WHERE Respond = 'Y'"; $result = mysql_query($query); $row = mysql_fetch_row ($result); $respondedquestions = $row[0]; $totalquestions = $respondedquestions + $pendingquestions; echo <<<_EOF <br /> <table> <tr> <td><a href="pendingarticles.php">Pending Articles</a></td><td><a href="pendingarticles.php">$pendingarticles</a></td> </tr> <tr> <td>Approved Articles</td><td>$approvedarticles</td> </tr> <tr> <td>Total Articles</td><td>$totalarticles</td> </tr> <tr> <td colspan="2"><hr /><td> </tr> <tr> <td><a href="pendingcomments.php">Pending Comments</a></td><td><a href="pendingcomments.php">$pendingcomments</a></td> </tr> <tr> <td>Approved Comments</td><td>$approvedcomments</td> </tr> <tr> <td>Total Comments</td><td>$totalcomments</td> </tr> <tr> <td colspan="2"><hr /><td> </tr> <tr> <td><a href="pendingquestions.php">Pending Questions</a></td><td><a href="pendingquestions.php">$pendingquestions</a></td> </tr> <tr> <td>Responded Questions</td><td>$respondedquestions</td> </tr> <tr> <td>Total Questions</td><td>$totalquestions</td> </tr> </table> _EOF; // Include the HTML footer file. include_once ('../includes/adminfooter.html'); ?>


Reply With Quote
Bookmarks