Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-17-2005, 08:43 PM
imajeenyus imajeenyus is offline
 
Join Date: Sep 2005
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to create a "members' area" in PHP?

Hello,

I recently bought vB 3.0.9 and have installed it on a test website. It runs great. I also want to create a separate members' area, let me explain.

I want to somehow password-protect an entire folder on the website. I could then post files etc there that only members would have access to. I thought on using .htaccess files but apparantly they become rather slow after a few hundred users have been added. I also want the users to be able to use their vBulletin login details to access the members area. Is it possible to write a PHP script to do this? Ideally, the PHP script would check up the same MySQL database that vB uses.

Actually, I came across a link on the web that seemed to be exactly what I needed: http://php.resourceindex.com/detail/03892.html but the site isn't available

I'd really appreciate any help with this!

Lindsay Wilson
Reply With Quote
  #2  
Old 09-17-2005, 09:55 PM
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Location: Fredericton, New Brunswic
Posts: 261
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

umm, it involves making a .htaccess file.

Code:
AuthName "Password Protected Area!"
AuthType Basic
AuthUserFile "location\of\.htpasswd"
require valid-user
save that ^^^ as ".htaccess" (make shure to include the dot!)

Code:
username:password
save that as ".htpasswd" (make shure to include the dot!)

and vola ^^ lme know if that works
Reply With Quote
  #3  
Old 09-17-2005, 10:31 PM
The Geek's Avatar
The Geek The Geek is offline
 
Join Date: Sep 2003
Location: Behind you
Posts: 2,779
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why not just use one of the file management enhancments on here? Im sure there is at least 1 that will allow you to control by usergroup. That would be FAR easier to manage.
Reply With Quote
  #4  
Old 09-18-2005, 02:36 PM
imajeenyus imajeenyus is offline
 
Join Date: Sep 2005
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

Pyro: Your code didn't appear in the post! Do you want to email it to me? My email is lindsay.wilson@strath.ac.uk (don't know if that'll be removed by the moderator!)

The Geek: I've been looking around for file management systems on the forum, but they all seem (to me ;-) rather complex. Could you suggest any simple ones you think might do, or any other way of doing this? There's gotta be some way of protecting a folder!

Thanks,

Lindsay
Reply With Quote
  #5  
Old 09-20-2005, 10:55 PM
pyro.699 pyro.699 is offline
 
Join Date: Sep 2005
Location: Fredericton, New Brunswic
Posts: 261
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

how bout this, you contact me on msn / aim ^^

pyro.699@hotmail.com
exiled twig
Reply With Quote
  #6  
Old 09-22-2005, 06:50 PM
imajeenyus imajeenyus is offline
 
Join Date: Sep 2005
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

I think I've solved the problem....

All the files that I want to be accessed by members only are located in a folder "secret" that is one level up from my "public_html" folder i.e. Joe Soap can't get the contents of that folder by entering it into his web browser.

I wrote a couple of PHP scripts. One, getfile.php takes a filename of something in the "secret" folder as its argument (e.g. getfile.php?do=members.htm) and sends the contents of the file to the browser. (Several if-loops deal with different file types and adjust the header "Content-type: " accordingly). It even works with HTML pages that contain images if the image is loaded via getfile.php.

The other script, authenticate.php acts as a login script. It basically uses a modified version of the vBulletin function verify_authentication (that's in /includes/functions_login.php) to check if a user is in the database. It also checks to see if the user has bought a subscription to the members' area (by checking the usergroupid) or if the user is an administrator. It then sets a cookie confirming that the user is authenticated. A login script, login.php, imitates the login text fields and button at the top of the main vBulletin page, and uses vbulletin_md5.js for encryption.

I do have the pages hosted online, but I'd rather keep the location secret for now! :nervous:

Thanks,

Lindsay

P.S. vBulletin is one helluva piece of coding!
Reply With Quote
Reply


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 06:13 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.03988 seconds
  • Memory Usage 2,205KB
  • Queries Executed 11 (?)
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_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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_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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete