Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 06-05-2003, 09:54 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Members area popup

Every time you access the members area, a popup window will show, asking you to enter the license number and pass:
"vBulletin Members Area: Please enter your customer number (username) and password:"

I would like to know what is the code used. Thanks.
Reply With Quote
  #2  
Old 06-05-2003, 10:14 PM
Regs Regs is offline
 
Join Date: Oct 2001
Location: Vancouver BC
Posts: 322
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Isn't that just a plain .htaccess popup?

~Regs.
Reply With Quote
  #3  
Old 06-05-2003, 10:22 PM
Serge's Avatar
Serge Serge is offline
 
Join Date: Jan 2002
Location: The Matrix
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP has a function for this as well. You use the header() thing hold on I think I saw a function to do this.

Here is what you could put at the top of your webpage:
PHP Code:
if (empty($PHP_AUTH_USER))
{
    
authenticate($realm,$errmsg,"header");
}
else
{
    
$query "SELECT username FROM author WHERE password = md5(lower('$PHP_AUTH_PW')) and username = lower('$PHP_AUTH_USER')";
    
$result mysql_query($query);
    if (
$result)
    {
        list(
$valid_user) = mysql_fetch_row($result);
    }
    if (!
$result || empty($valid_user))
    {
        
authenticate($realm$errmsg"query");
    }

The authenticate function would look something like this:
PHP Code:
function authenticate ($realm="Secure Area"
    
,$errmsg="Please enter a username and password"
)
{
    
Header("WWW-Authenticate: Basic realm=\"$realm\"");
    
Header("HTTP/1.0 401 Unauthorized");
    die(
$errmsg);

Reply With Quote
  #4  
Old 06-07-2003, 01:20 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks. That's what I needed.
Reply With Quote
  #5  
Old 06-07-2003, 11:42 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Where does it get the username and password from?
Reply With Quote
  #6  
Old 06-07-2003, 12:29 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You have to manually enter it.
Reply With Quote
  #7  
Old 06-07-2003, 06:21 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm. But i mean how does it compare the password entered in this pop-up to another one to see if its correct?

- miSt
Reply With Quote
  #8  
Old 06-07-2003, 06:27 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Search around on php.net for HTTP authentication. They give an example there. I also used it a year ago in a project at work where it used a MySQL database and it worked nicely (no cookies, too).
Reply With Quote
  #9  
Old 06-07-2003, 07:34 PM
MUG MUG is offline
 
Join Date: Apr 2002
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Today at 03:21 PM Mist said this in Post #7
Hmmm. But i mean how does it compare the password entered in this pop-up to another one to see if its correct?

- miSt
$_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW']
Reply With Quote
  #10  
Old 06-08-2003, 01:50 AM
Serge's Avatar
Serge Serge is offline
 
Join Date: Jan 2002
Location: The Matrix
Posts: 115
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Yesterday at 08:21 PM Mist said this in Post #7
Hmmm. But i mean how does it compare the password entered in this pop-up to another one to see if its correct?

- miSt
Yes I was going to stay look at the query again it has the password listed in there. Also I don't know if I did it up there but you could md5 the password as well if you have md5 protection on your passwords.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:01 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04588 seconds
  • Memory Usage 2,255KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete