PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

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 1st, 2003, 01:39 PM
fearx24 fearx24 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 9 fearx24 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Help with PHP Authentication and Realm?

I read the Mysql, PHP article here on DevArticles about setting this up but I have a problem. How exactly does the Realm work not sure if I understand, but anyways when using this basic code here with a user and password hard coded, the authentication box just keeps popping back up after I have entered the correct user and password. Any help

PHP Code:
<?php 

    
// File Name: auth02.php

    // Check to see if $PHP_AUTH_USER already contains info

    
if (!isset($PHP_AUTH_USER)) {

        
// If empty, send header causing dialog box to appear

        
header('WWW-Authenticate: Basic realm="My Private Stuff"');
        
header('HTTP/1.0 401 Unauthorized');
        echo 
'Authorization Required.';
        exit;

    } else if (isset(
$PHP_AUTH_USER)) {

        if ((
$PHP_AUTH_USER != "admin") || ($PHP_AUTH_PW != "abc123")) {

            
header('WWW-Authenticate: Basic realm="My Private Stuff"');
            
header('HTTP/1.0 401 Unauthorized');
            echo 
'Authorization Required.';
            exit;

        } else {
            echo 
"
            <P>You're authorized!</p>
            "
;
        }
    } 
?>

Last edited by fearx24 : April 1st, 2003 at 01:52 PM.

Reply With Quote
  #2  
Old April 2nd, 2003, 12:25 PM
fearx24 fearx24 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 9 fearx24 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Anyone have any possible causes of this even if you dont know whats wrong. Pulling my hair out trying to get this simple thing to work. Not sure if I am overlooking something or just dont know what Im doing.

thanks Nick

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Help with PHP Authentication and Realm?


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 5 hosted by Hostway