PDA

View Full Version : Yet Another vB Login on non-vB Page


calorie
26 Jun 2005, 20:20
This is not a plugin, nor is it a code modification. It is a separate script, so just configure the attached script, FTP it to wherever, and then call it from your browser. Once you test it out, you can edit the script to show whatever content you desire. Look at the code to see where to set your content. If you don't like this script, try mcahill's vB login on a non-vB page here (http://www.vbulletin.org/forum/showthread.php?t=61112).

If you use this script, click the install button. This allows you to receive update notices, should any be sent. It is also a nice way to say thanks!

Fine Print: Obviously, use at your own risk. Support is not guaranteed. This script may not be redistributed!

25 Jul 2005: added $session to make_page_content global list

CyberRanger
08 Jul 2005, 14:07
Neat, I like how access is so easily controlled by the user group. I did notice that I had to slightly modify how I setup the path to my forums. My forum is in a folder called forums just below my docroot. If my example file is in the docroot (ie, above the forums folder) I had to set the full path as:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



That's running Suse with Apache2.

CyberRanger
08 Jul 2005, 21:49
One question on setting the usergroups. I can only seem to get it to work if that is the user's primary usergroup. Can it also check "Additional Usergroups"?

Thanks!

calorie
09 Jul 2005, 02:46
@westpointer: try the attached...

CyberRanger
11 Jul 2005, 21:44
@westpointer: try the attached...
Thanks! That works great.

I've modified the code a little, setting a variable depending on whether or not the user is a member of the group:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Then when the page is output:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



That gives me very nice granular control for what is displayed based on the forum groups. Thanks!

Snetty
25 Jul 2005, 12:56
k, i like the look of this script. My problem is 2 fold, I don't need (or want) any usergroup support at the moment, I assume if i remove lines 95 -> 110 then this will solve that problem.

My 2nd problem is a touch more complex. I only want to display the welcome box (and be able to style it as I see fit). Looking at the code though it's calling the whole $header variable which is already made up by vb. What would I replace that with to meet my needs?

calorie
25 Jul 2005, 16:52
@Snetty: You could just set UGS to all usergroup IDs to bypass the login page. As for what you want to display, just set $src_output as shown in the script.

FASherman
25 Jul 2005, 22:05
How difficult would it be to expand this to something a little more complex?

What I'd like to see is something that:


Writes the forum header
Writes the breadcrumbs
Runs any PHP script, capturing its oputput as a variable via ob_start/ob_capture/ob_stop - thus avoiding header already sent/redefinition errors
Writes the script output
Writes the forum footer.

calorie
01 Aug 2005, 02:01
@FASherman: you can do all of that. I was writing another example to show but haven't finished it yet. Thought I'd better fill in this post though. :speechless:

Mimoun
02 Aug 2005, 11:33
Is it possible to only show the small box that is on the right side of the navbar.
I want to extract data from the $navbar who do I do that?

Mimoun
02 Aug 2005, 11:56
I want to put the small login box that is on the right side inside the navbar on an external page.
I have tried using your script but it just uses the whole navbar with the variable $navbar there is no way to extract it from the $navbar because it just prints the whole navbar at ones.
Here is a screenshot of what I would like to extract:
http://www.freewebsitetemplates.com/screenshothelper/loginbox.gif

Styles P
02 Aug 2005, 17:22
Will this work on version 3.0x ?

calorie
02 Aug 2005, 17:32
Will this work on version 3.0x ?
If you set the following, it should work for vB307.


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

calorie
03 Aug 2005, 20:12
@Mimoun: To get part of the navbar, like in the attached picture, see the attached ZIP file.

Mimoun
03 Aug 2005, 22:17
Thank you very much Calorie I will try it out right now.

Mimoun
03 Aug 2005, 23:33
I have tried the script on my test forum and it works there is only 1 problem.
When I check my forum it shows the small login box 2 times.
Is it possible to get the small login box on an external page without including it in the navbar template?
Thanks again for making the script.

calorie
04 Aug 2005, 00:11
@Mimoun: Try the example2.php file by itself. In the example2 script, do you see only one small login box?

Mimoun
04 Aug 2005, 00:31
Yes in the example2.php I see only one login box but on my forum I have the whole navbar + the small login box:
Here is a screenshot:
http://www.freewebsitetemplates.com/screenshothelper/navbar.gif

calorie
04 Aug 2005, 01:02
@Mimoun: Looks like $navbar is printed twice, once before and once after the eregi_replace. Check the template for two $navbar variables.

Mimoun
04 Aug 2005, 11:47
Sorry I misunderstood the readme file I placed the whole code in my navbar.

I checked the source code and understand now how you did it. You just get the whole navbar and strip down everything except the small login box part very clever.

Could it be possible to place the small login box part in a new template and call the template loginbox so you can give it his own style without damaging the loginbox in the navbar?

Thanks for your help.

calorie
04 Aug 2005, 14:45
In the readme replace:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


With the following:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


And also replace:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


With the following:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


And then save the readme, execpt the instructions, as a template called smallloginbox and
then use the following:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


To get the template, and then use $smallloginbox like you would use $navbar to show the content.

You can also add smallloginbox to $globaltemplates if you want to cache the template.

Mimoun
04 Aug 2005, 15:31
It works perfect now thank you very much.

If you have a website that needs a new design just pm me and I will make one for you for free. That's my way of saying thanks.

Mimoun
09 Aug 2005, 17:31
After a lot of editing the script I got it fully customized.
You can see it working on my site (http://www.freewebsitetemplates.com/) .
Thanks again calorie I have learned a lot from your script.

Boofo
09 Aug 2005, 17:51
After a lot of editing the script I got it fully customized.
You can see it working on my site (http://www.freewebsitetemplates.com/) .
Thanks again calorie I have learned a lot from your script.

I just joined your site. Awesome job. ;)

ddas
10 Aug 2005, 19:34
Hi,

Iīve set up example2, works fine standalone.
But once itīs included from another page I get the following error message:

Fatal error: Call to undefined method stdClass::query_first() in /var/www/community/messageboard/includes/functions.php on line 938

How come?

take care
Flint Stelter
http://www.ddas.de

calorie
03 Sep 2005, 17:14
@ddas: It's not finding what it needs, but not sure what you mean by including it in another page. The script is meant as standalone so you can add vB type pages wherever you want by simply editing the script.

Disi
06 Sep 2005, 14:43
Hiho, can someone tell me how to get the login correct?

i've tryed the script and it always redirects after the login to domain.tdl/login.php..

it should be domain.tdl/board/ or something like this

regards,

dennis

Mimoun
06 Sep 2005, 15:32
@ddas: It's not finding what it needs, but not sure what you mean by including it in another page. The script is meant as standalone so you can add vB type pages wherever you want by simply editing the script.

I think he means when using this:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Didn't work for me too I just had to do a copy past for all pages.
Not a good way to do it, but it only works like this.

calorie
07 Sep 2005, 17:04
@Disi: Check the allowed usergroups. If you want both primary and secondary groups, do this (http://www.vbulletin.org/forum/showpost.php?p=732798&postcount=4).

Disi
09 Sep 2005, 21:38
@Disi: Check the allowed usergroups. If you want both primary and secondary groups, do this (http://www.vbulletin.org/forum/showpost.php?p=732798&postcount=4).

shouldn't have to do with the user groups because i added all groups :)

calorie
10 Sep 2005, 17:46
@Disi: Does this happen when you upload example.php and try to login?

Disi
11 Sep 2005, 00:26
@Disi: Does this happen when you upload example.php and try to login?

nope :(

calorie
11 Sep 2005, 15:32
@Disi: Okay, as example.php works, it seems that whatever edits you made to the file are causing the issue, but without knowing the edits, I cannot say why you have an issue, so just recheck your edits.

Zelda-King
30 Oct 2005, 12:10
After a lot of editing the script I got it fully customized.
You can see it working on my site (http://www.freewebsitetemplates.com/) .
Thanks again calorie I have learned a lot from your script.I can second that now. :)

mattfl
14 Nov 2005, 23:55
This is great, I'm still kind of new to the whole world of vbulletin and php so I have a question and I'm not sure if it can be done with your script or not.

On my website, i have an members images area that you must login to view the images. I'm also running vbulletin as well.

What I'm wondering, is it possible to use this script as a login page to the images area and have it authenticate the users in the vbulletin database?

Basically, a user registers for an account on my site, the registration process is actually the vbulletin registration process, so the username/password gets added to the vbulletin database tables, I want to be able to use that login to access either the images gallery or the forum, but there will be a seperate login page for the images and then the standard vbulletin forum login. Thanks

calorie
16 Nov 2005, 04:47
@mattfl: It is possible to 'wrap' other PHP scripts in vB authentication, it may or may not take some time and energy, and you might still need to block direct requests to images.

mattfl
17 Nov 2005, 17:38
@mattfl: It is possible to 'wrap' other PHP scripts in vB authentication, it may or may not take some time and energy, and you might still need to block direct requests to images.

the image gallery is not so much a gallery, but it's basically writing a cookie to the users machine to say that they logged in, and then that is giving them access to view the images. It's not a complete gallery type setup, just kind of a way to tell if the user has registered for our site...basically what we wanted was a way for a user to create one login account that will be for both the images and for the forums.

calorie
17 Nov 2005, 18:17
Try out the example script, stick it somewhere outside your forum directory, and see if it does like you want, as that is probably the best way for you to evaluate it. If you like it, then you'll need to wrap the PHP gallery files some way like username is wrapped in the example script, assuming you want to protect PHP files outside of your forum directory while having the look of a vB page. If you are just looking to determine whether someone is logged in, nothing fancy, then you can stick the following atop the gallery files, and this will work fine for those users who accept cookies:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Bernd Glasstett
09 Dec 2005, 00:33
This is a fine script, however it doesn't replace replacement-variables. Could this be please included too? It's just that we have a lot replacement-variables in our forum.

jeffj
24 Jan 2006, 17:35
I cannot get this working properly on vb3.5

even if I remove header, footer and navbar from the code below - they still show up.

I want to create a small login box like the one used in myvbindex to display on a non vb page via an Iframe...

any ideas?

$src_output = <<<END
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
$headinclude
<title>$vboptions[bbtitle]</title>
</head>
<body onload="$onload">
</body>
</html>
END;

ConKien
24 Feb 2006, 03:36
Did you ever come up with an exmaple for this Calorie?

How difficult would it be to expand this to something a little more complex?

What I'd like to see is something that:


Writes the forum header
Writes the breadcrumbs
Runs any PHP script, capturing its oputput as a variable via ob_start/ob_capture/ob_stop - thus avoiding header already sent/redefinition errors
Writes the script output
Writes the forum footer.




This script is great!

Griffin80
10 Apr 2006, 06:41
In the readme replace:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


With the following:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


And also replace:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


With the following:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


And then save the readme, execpt the instructions, as a template called smallloginbox and
then use the following:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


To get the template, and then use $smallloginbox like you would use $navbar to show the content.

You can also add smallloginbox to $globaltemplates if you want to cache the template.

Love this hack great work ;)

Ive got the hack working good, but i want to edit the navbar so its a template like in this post i have quoted from you but i am not sure where to put this:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

Griffin80
10 Apr 2006, 06:43
its all good i figured it out hehe

aceofspades
01 May 2006, 12:44
i get this:


Warning: chdir(): No such file or directory (errno 2) in /home/hiven48/public_html/files/example.php on line 56

Warning: main(./global.php): failed to open stream: No such file or directory in /home/hiven48/public_html/files/example.php on line 57

Fatal error: main(): Failed opening required './global.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/hiven48/public_html/files/example.php on line 57


Please tell me why :'(

Griffin80
01 May 2006, 15:48
one problem i am having is with the CSS.

my forum:
http://www.bluepearl-design.com/forums

the index of my site using this script:
http://www.bluepearl-design.com/index.php

As you can see alot of the background images in my tables are not showing at all and i cant figure it out :S

this is my CSS: in style manager (MAIN CSS)


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



and here is my table code:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I know this will work perfectly if use the <b>background </b> tag in the table but i want to use CSS to keep my site XHTML compliant.

Any help will be appreciated, thx ;)

twitch
01 May 2006, 19:17
This is just what I need, thanks!

Griffin80
02 May 2006, 07:25
one problem i am having is with the CSS.

my forum:
http://www.bluepearl-design.com/forums

the index of my site using this script:
http://www.bluepearl-design.com/index.php

As you can see alot of the background images in my tables are not showing at all and i cant figure it out :S

this is my CSS: in style manager (MAIN CSS)


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



and here is my table code:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I know this will work perfectly if use the <b>background </b> tag in the table but i want to use CSS to keep my site XHTML compliant.

Any help will be appreciated, thx ;)


dont worry i got it sorted now.

u just need to remove "" from the css like so:


Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------

DHDesign
13 Sep 2007, 20:27
everything is working great..thanks alot!

one quick question...upon hitting log out, how can i redirect so that after the log out process has been completed, it comes back to the original log-in page that i have?

the way it is right now, if you click on log out, then you are taken to vB's logout that indicates "All Cookies have been cleared" and leaves you there rather than kicking you back to the main login page.

thanks!

msnhockey
25 Nov 2008, 21:15
for seem reason when placed on my index.php page the stuff shows up, but when I log in and then re-directs back to my index.php page it is asking for me to log in again.

any ideas as to why.. I am thinking session cookies or something

kwchan
01 Feb 2009, 07:40
finally works for me, but I have to put everything in the root folder as the forum

the script don't work if the php files are in another folder

falco008
18 Jan 2010, 13:02
i would love to have this set up for my site but I have absolutely no idea how to.. anyone care to guide me through step by step ?

I want to integrate my Vbulletin login and welcome box in a sidebar on my wordpress main page:

www.pokerclub.be/forum
www.pokercub.be/wordpress

I have made some test and I can get a login box to appear, on my wordpress page, my vbulletin users can login to the site and get redirected to the wordpress page again, but it then doesnst show a welcome block ..

any help would be appreciated