vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to create a "members' area" in PHP? (https://vborg.vbsupport.ru/showthread.php?t=96463)

imajeenyus 09-17-2005 08:43 PM

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 :mad:

I'd really appreciate any help with this!

Lindsay Wilson

pyro.699 09-17-2005 09:55 PM

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

The Geek 09-17-2005 10:31 PM

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.

imajeenyus 09-18-2005 02:36 PM

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

pyro.699 09-20-2005 10:55 PM

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

pyro.699@hotmail.com
exiled twig

imajeenyus 09-22-2005 06:50 PM

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!


All times are GMT. The time now is 07:12 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00972 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete