General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old April 28th, 2003, 02:02 PM
prendo prendo is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Leeds, UK
Posts: 2 prendo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to prendo
authentication script problems

Hi,

I'm a php newbie trying to setup a user authentication a script that I downloaded from http://www.bgdev.goto.bg/bgdev_login.php and I'm having some problems with the admin section. There's not much in the way of support on the site in question so I just wondered if anyone would mind helping me out here.

When I try to view the admin page I get this error message 'error 500: Internal Server Error with admin script'. I get the same error message when I try to access any file in the admin directory called 'loginadmin'. Any directories above this directory level, ie the main user authentication scripts, are fine.

The full admin code looks like this:

index.php

PHP Code:
<?php include("login.php"?> 
<?php include("users_db.php"?> 
<?php include("messages_db.php"?> 
<center> 
<h2>BGDev Login! admin</h2> 
<BR> 
<b><?php echo $usersdb ?></b> registered users<BR> 
<b><?php echo $messagesdb ?></b> messages<BR><BR> 
<BR> 
<a href="view.php"><?php echo $lang[adminusers?></a><BR> 
<a href="sn.php"><?php echo $lang[sendnewsletter?></a><BR>



login.php

PHP Code:
<?php 
include("../config.php"); 
$LOGIN "$admin"
$PASSWORD "$adminpass"

function 
error ($error_message) { 
   echo 
$error_message."<BR>"
   exit; 


if ( (!isset(
$PHP_AUTH_USER)) || ! (($PHP_AUTH_USER == $LOGIN) && ( $PHP_AUTH_PW == "$PASSWORD" )) ) { 
   
header("WWW-Authenticate: Basic entrer=\"Form2txt admin\""); 
   
header("HTTP/1.0 401 Unauthorized"); 
   
error("&"); 

?>



users_db.php

PHP Code:
<?php include("../config.php"); 
$connection mysql_connect("$server""$db_user""$db_pass"); 
        
$db mysql_select_db("$database"$connection); 
        
$query "SELECT * FROM login"
        
$result mysql_query($query$connection); 
   
$usersdb=mysql_numrows($result); 


?>



messages_db.php

PHP Code:
<?php include("../config.php"); 
$connection mysql_connect("$server""$db_user""$db_pass"); 
        
$db mysql_select_db("$database"$connection); 
        
$query "SELECT * FROM usermessages"
        
$result mysql_query($query$connection); 
   
$messagesdb=mysql_numrows($result); 


?>




Can anyone see any likely reason why the server is having problems with this set of scripts. I've already spoken to my ISP and they can't see anything wrong. I'm just wondering if it might be something to do with my php.ini file but I'm just guessing really as I'm quite new to this level of scripting. I havn't really used 'header' files before either so I wouldn't have a clue where to start debugging.

Any help greatly appreciated.

Thanks!

Reply With Quote
  #2  
Old April 29th, 2003, 04:01 AM
jaguar_wolf jaguar_wolf is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 8 jaguar_wolf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Use these

Try to use these files i think this will work but you have to create a form with 2 fields named
username
password

Thanks
Attached Files
File Type: zip login.zip (1,018 Bytes, 299 views)

Reply With Quote
  #3  
Old April 29th, 2003, 09:23 AM
prendo prendo is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Location: Leeds, UK
Posts: 2 prendo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to prendo
Thanks, I'll give them a try

I've tracked the above problem to the following lines in the 'login.php' script:

if ( (!isset($PHP_AUTH_USER)) || ! (($PHP_AUTH_USER == $LOGIN) && ( $PHP_AUTH_PW == "$PASSWORD" )) ) {
header("WWW-Authenticate: Basic entrer=\"Form2txt admin\"");
header("HTTP/1.0 401 Unauthorized");
error("&");

If I delete this I can access the admin pages and they work. I'm not sure why tho.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > authentication script problems


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway