![]() |
Simple vB User login and access control on non vB pages
Hack Description
This is a cut down version of the user authentication and access control system I use on the non vB pages on my website. This uses the vB 3.7 login system to log you in and out. It allows you to move between your forums and other pages on your site while remaining logged in. It allows you to do things such as restrict pages by usergroup, display different content depending on a user being logged in or not. For example, you can have banner Adds displaying to non members only, and/or let members access to specific content. Ive cut it down to the bare minimum that it needs to work, no fancy stuff such as avatars, PM's, or even formating. I will try and offer support, but work and family commitments mean I don't have much free time. This code is a mix of my own, and pieces I have used from other hacks that are floating around. This script has been confirmed as working on
Change log Version 2.00 (21st March 2008)
Click on Install If you have this script installed then please click on the install link because;
Donations First of all, to be clear. This script is 100% free. However if you feel an urge to donate I'm not going to say no. :) Donations can be made at http://www.billspaintball.com/vb3/bd_donate.php |
Usage
The hack is pretty useless without some usage instructions so here they are. We can use conditionals to hide or display depending on a number of things such as Logged in or out status, or restrict to members of a specific usergroup. We do this by using conditionals in php tags where the normal content of a webpage would go. If you want something only accessable to a certain usergroup, use this code in your webpage. This example is only visible to members of usergroup 6. PHP Code:
For example, PHP Code:
For example: PHP Code:
Another use is to display different content to users depending on if they are logged in or not. For example PHP Code:
For example PHP Code:
Troubleshooting If your reading this chances are you are having problems. Here are some common causes and fixes.
|
superb stuff, brilliantly presented info. Thanks
|
Good one :up:
I have been wanting to do this but have been putting it off due to time restrictions. You've made things alot easier and quicker for me by creating this mod, thank you so much. *installed |
Wow, very timely!
I am developing a new section of the site, but it will be for forum users only. My one glitch, the pages will be in cold fusion, not php. Any chance something like this could be modified for cfm pages? |
Just about to launch my new layout and wanted something like this to be released, thanks!
|
wow! this is great!!
|
Quote:
|
I have been struggling getting this to work for me. I am just trying to get the test.php script to work first. when i am not logged in, i cannot log into the pages off of vb, they are linked to the folder i have my non-vb files in, rather than the forum folders.
www.mydomain.com/forums www.mydomain.com/music i want to use this script in the music folder. when i try to load the test.php file, it looks for images and registration stuff under /music/images and /music/register.php rather thant /forums/images and what not. i have tried various setups for the login_inc.php file and also put the music folder inside the /forums dirstory (/forums/music) and still with no luck. im pretty sure its something stupid and i'm over thinking this whole problem. but your help would be much abliged. thanks much. |
I had a devil of a time with this too, until I changed the URL in my login_inc.php from
this: PHP Code:
PHP Code:
|
still running into issues...the login page that is generated makes links for the registration page and the login script to the /music/log.php etc...rather than /forums/login.php. even the logo is messed up
|
Super simple and works great!
|
Quote:
|
Quote:
Quote:
|
i did this hack and got this error...
Unable to add cookies, header already sent. File: /home/content/b/e/r/berry05/html/tyler.php Line: 3 and i did what the troubleshooting told me to do also... |
This si another awesome mod, will it be to hard for a newbie to use?
|
i keep getting errors :s
Warning: chdir() [function.chdir]: No such file or directory (errno 2) in /home/fragreel/public_html/td2142/template/header.inc.php on line 4 Warning: require_once(/home/fragreel/td2142/forum/global.php) [function.require-once]: failed to open stream: No such file or directory in /home/fragreel/public_html/td2142/template/header.inc.php on line 5 Fatal error: require_once() [function.require]: Failed opening required '/home/fragreel/td2142/forum/global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/fragreel/public_html/td2142/template/header.inc.php on line 5 |
I wonder if its possible to see a working example rather than just the code snippets?
PHP Code:
I am wondering, where is the variable $vbulletin created? Does it need to be declared as a global? cheers (: |
have some problems with this, the form works OK but when it returns to the page it still doesn't show me as logged on...
I did everything in the instructions... anyone cares to help? |
anyone?
I even managed to lock myself out by changing the cookie domain etc. and then had to reverse it by using tools.php. I'd love some ideas.... |
When i inserted it in to my blog so my users can login in my word press bridge i found my self doing alot of /" because often you would use quotes to open the echo then you would use them again in the html
and it also seems that it doesn't pick up when the user is logged in. it just brings the form back |
Warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/XXXXX/public_html/news/inc/functions.inc.php on line 43
Seems to be affecting cutenews. |
Appears to login ok but won't show I as logged in,
In Simple Login Instructions; Quote:
|
Quote:
I'm having the same problem, I even added the urls on the whitelist. I'm not sure what I'm doing in correct but here's my entire file, thus far I've only been testing. However, my issue pertains to the fact that I'm actually using two subdomains. My forums has a subdomain and the other aspect of the site that I'm using also has a subdomain. |
Anyone?
|
<font face="Tahoma">I found out that you have to reset your browsers then use the website, or else it will continue cause problems.</font>
|
I've got the same problem as some others, the form seems to work, but it still shows as logged off.
I've tried to set the path of the cookies to "/" and then clear my cookies then try to connect and still doesn't work. I found out that if I go directly to the forum then connect then move to another section of my website, it'll then show as if I'm logged. Thanks for help |
Quote:
|
I have even installed additional hack to use cookie on few different domain. But still this plugin shows that I am not logged in... Will there be instructions or updated version?
|
Great hack.
I was wondering if there was a way to suppress the banned notification for banned users? If a banned user browses non-vb pages, those pages are also blocked from view. I'd prefer that non-vb pages with this hack are viewable for banned users. |
Thank you!
|
I've finally got the script working - almost.
I can log in alright - but it does not show that i am logged in on the frontpage - only the log in box. I've checke my cookies path in the admincp and it is set to "/" - I've tried different browser and clearing my cookies etc. But nothing seems to work? If it is to any help - im using wordpress. |
In response of MadsK, this bug seems to happen to a lot of us. I would really like to get some help from the developer of the code or from anyone else to find a way to solve this problem. This login box is a really important part of my website and right now it's a pain in the a** not to be able tu use it
|
I found the trick to make it happen.
Below is the code i use for my site. It has been altered a little with some extra links after you've logged in but they can be changed. I've tested it with a couple of different friends on different computers, operating systems and browsers and it works on all of them. With that said this is only working with Wordpress as it collects the cookie from the wordpress database and outputs it. When logging out it also clears both wordpress and vbulletin cookie! I would really like some feedback on it :) You can see it in action on my website http://www.swtorcommunity.com Code:
<?php |
Than you for this useful hack!
How can i include header and navbar template to this script? |
MadsK, any way to make your code work for those who aren't on Wordpress?
|
You could try to replace the $user_id with the vbulletin equilant. But i'm not sure which that is.
|
Okay - first off Props to the poster - this is a great little addon
Now if anyone is having issues with login.php here is the be all fix put the .php file inside your /forums directory this will solve most issues as you are using vbulletin functionality from outside it's operating path - and is where you are most likely running into issues For example prior I had a php page at mydomain/LINKS - the index.php was the link checker. When adding this hack in that /LINKS dir I was having issue (and I am not a code noob) - however the moment I put the php in my /forums directory and replaced my index.php on /LINKS with a frame loading the php from it's new location - everything works fine Any just a bitta info - oh and always - perfect syntax people Peace .* |
Nope it doesn't work.
I put the .php that contains the login form in my forum folder, still shows as if i'm logged out. |
Ok, I've been trying to get this working for a fair while now, I'm getting the same problem as a lot of people here, the script continues to show the login form after logging in.
I'm running Ubuntu and FF3, it shows logged out, however running under IE6 (using wine) it worked correctly the first time only (would work again even clearing cookies, history, re-opening browser etc). I noticed when it did work it sent back a session string as a _GET variable, but I couldn't get it to do that more than once without resetting my cookies etc. Still gonna work on it some more, but thought I'd share what I've found so far. cOwMoO |
All times are GMT. The time now is 06:05 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|