Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Auth_vBulletin and Authentication

(Page 1 of 2)
> >
Quote Reply
Auth_vBulletin and Authentication
Hi,

I'm still having problems fully integrating a static GLinks 3.2.0 implementation with VBulletin 3.6.0 (as per http://www.gossamer-threads.com/perl/gforum/gforum.cgi?post=291880;)

Having searched the forums I can't find anything that appears to be an official solution to the problems that I and others have had regarding user authentication.

Questions:
  1. If a logged-in vBulletin user (who has the default vBulletin cookie) goes to the links area, the JavaScript on static pages doesn't detect that they're logged in. How can I fix this?
  2. If a registered vBulletin user (who has a cookie) goes to the links area, they are not able to log in. How can I fix this without asking them to visit the forum and then navigate back to links?
  3. The old version of Links 2.0 had about 2,000 people registered to get the update newsletter. How can I import them so that they can continue to get the newsletter?
I've attached an error log for an unregistered user attempting to log in via the normal form (just in case that helps).

Does anyone have any ideas on any of the above?

Any help will be very much appreciated, so thanks very much in advance.

:-)
Quote Reply
Re: [Red5] Auth_vBulletin and Authentication In reply to
I am having exactly the same problem - using Vbulletin 3.6. The static pages do not recognise that the user is logged in (but dynamic pages do).

Can someone please provide an answer; this is driving me mad trying to solve it.
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
If you know the name of the cookie in vBulletin, this my be a different approach you can use:

http://www.gossamer-threads.com/...i?post=293666#293666

Hope this helps,

- Jonathan
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
In Reply To:
If you know the name of the cookie in vBulletin, this my be a different approach you can use:

http://www.gossamer-threads.com/...i?post=293666#293666

Hope this helps,


I had a look through that and it looks like a pretty complicated fix. Although I am comfortable with coding, I am not sure that I really understand all of the instructions there.

I get an error "Unknown Tag: 'log' " having followed the final post to the letter.


The problem is that the Auth_vBulletin plugin doesn't work with current versions of vBulletin - and that is what needs fixing really.

Last edited by:

swissbob: Sep 30, 2006, 9:19 AM
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
OK, I presume that as well as everything in your final post, I also need to include this:

Code:

'log' => 'sub {
my $output;
my $session_id = GT::CGI->cookie(\'s\') || GT::CGI->param(\'s\');
if ($ENV{SCRIPT_NAME} =~ /nph-build/) {
$output = \'<!--#include virtual="/cgi-bin/log.cgi" -->\';
}
elsif ($ENV{QUERY_STRING} =~ /logout/) {
$output = "<a href=\'$CFG->{\'db_cgi_url\'}/user.cgi\'>Login</a>";
}
else {
if ($session_id) { $output = "<a href=\'$CFG->{\'db_cgi_url\'}/user.cgi?logout=1\'>Logout</a>"; }
else { $output = "<a href=\'$CFG->{\'db_cgi_url\'}/user.cgi\'>Login</a>"; }

}
return $output;

}',

My question is... where does that go?
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
Don't use that global. Just follow the directions on my LAST post.

- Jonathan
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
Well, I did that and just get the error: Unknown Tag: 'log'

I can't see where the tag is registered in your instructions
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
The global registered is 'login' - should that be 'log' instead?

I am getting really confused about this - I apologise. I am pretty sure that I have followed the instructions to the letter (and done nothing else).
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
I just wish the author would contribute more to making the plugin work. I don't like modifying code as you lose it all the next time the code's updated.

It's such an almost-awesome plugin that it deserves to be brought up-to-date. ;-)

Last edited by:

Red5: Sep 30, 2006, 9:49 AM
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
This is the only code you should use:

Quote:


here is the perl file log.cgi

Code:

#!/usr/bin/perl
#================================
use strict;
use lib '/home/httpd/vhosts/magicdirectory.com/cgi-bin/admin';
use Links qw/$IN/;
Links::init('/home/httpd/vhosts/magicdirectory.com/cgi-bin/admin');
use Links::SiteHTML;
local $SIG{__DIE__} = \&Links::fatal;
main();
sub main {
#---------------------------------------------------
#
my $username = $IN->cookie('Community_Name') || $IN->param('Community_Name');
print $IN->header;
print Links::SiteHTML::display('include_login', {Username => $username});
}



If you use GCommunity, then make sure you have not renamed your session name under

Setup -> User Session -> session_cookie_name_user

If you do not use GCommunity, then "Community_Name" should be replaced with "s".

You should create a global, say, "login" OR "log" with this sub routine:

Code:

sub {
my $output;

if ($ENV{SCRIPT_NAME} =~ /nph-build/) {
$output = '<!--#exec cgi="/cgi-bin/log.cgi" -->';
}
else {
$output = Links::SiteHTML::display('include_login');

}
return $output;

}



<%log%>, which you can put in your include_header.html file, will now automatically check to see what kind of file it is loaded. This requires SSI, so your files must be built with .shtml extension. Remember to also check your cgi paths.

Last but not least, you must create an "include_login" template file with something like this:

Code:

<%if Username%>
[<a href='<%db_cgi_url%>/user.cgi?logout=1'>Sign Out</a>,
<a href='<%db_cgi_url%>/user.cgi'>My Account</a>]
<%else%>
<a href="<%db_cgi_url%>/user.cgi">Sign In</a>
<%endif%>



Although javascript can seem easier, it is run from the user end. I am just completly anti-javascript when there is no need for it.

Hope someone uses this,

- Jonathan
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
OK, I must be missing something here.... now it just prints out:


sub { my $output; if ($ENV{SCRIPT_NAME} =~ /nph-build/) { $output = ''; } else { $output = Links::SiteHTML::display('include_login'); } return $output; }


I presume that this means that it isn't being parsed as a script and is being presented as HTML instead. And yes, this is using .shtml pages.

Thanks for your patience and help with this

Last edited by:

swissbob: Sep 30, 2006, 9:55 AM
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
Did you copy that sub exactly under Build->Template Globals?

- Jonathan
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
Yes. It is there, and it is being included.... it just isn't being parsed as a script.

Last edited by:

swissbob: Sep 30, 2006, 10:42 AM
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
I have no idea, unless your doing something wrong. Under Build->Template Globals there should be something like this:




- Jonathan
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
Yes, it looks just like that
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
I have no idea!

Let me ask you. Is your problem that when you are logged into vBulletin and you go to Links, the login screen apears asking you to login again (like when you go to add.cgi etc.) or is the problem that Login is displayed instead of Logout. These sound like the same thing, but not. If your problem is more than just displaying Login / Logout at the right times, there is no point of even using my method.

- Jonathan
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
In Reply To:
I have no idea!

Let me ask you. Is your problem that when you are logged into vBulletin and you go to Links, the login screen apears asking you to login again (like when you go to add.cgi etc.) or is the problem that Login is displayed instead of Logout. These sound like the same thing, but not. If your problem is more than just displaying Login / Logout at the right times, there is no point of even using my method.

It is the same problem as Red - it is displaying the 'log in' message on the static pages, even if a user is logged in. On the dynamic pages, it shows the 'log out' message, as it should.

I don't think that this has any bearing on the problem of the global not being parsed as a script though?
Quote Reply
Re: [swissbob] Auth_vBulletin and Authentication In reply to
I think that the reason it is displaying the code instead of executing it is because you have a space before sub.

so it should be "sub { whatever }" not " sub {whatever}".

- Jonathan
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
In Reply To:
I think that the reason it is displaying the code instead of executing it is because you have a space before sub.

so it should be "sub { whatever }" not " sub {whatever}".

I already spotted that one... I will keep fiddling with it and see if I can work out what is wrong.

Cheers.
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
Hi,

Having read your post a little closer I realise I was mistaken about it modifying the GLinks code. I've just implemented your code and it seems to work just fine. Thanks very much for the plugin! :-)

However, I have one concern. My server currently has EXEC CGI switched off, so this will not work:

<!--#exec cgi="/cgi-bin/log.cgi" -->

I've just read this: http://httpd.apache.org/...ml#executingcommands

Quote:
Note that this feature is exceedingly dangerous, as it will execute whatever code happens to be embedded in the exec tag. If you have any situation where users can edit content on your web pages, such as with a "guestbook'', for example, make sure that you have this feature disabled.

Is this something to be concerned about?
Quote Reply
Re: [Red5] Auth_vBulletin and Authentication In reply to
If it will allow you to execute it, it is perfectly safe.

I suppose if your server does not allow SSI, but does allow php, you could use a .phtml extension with:

<? include "/path/to/perlfile.cgi"; ?>

instead of

$output = '<!--#exec cgi="/cgi-bin/log.cgi" -->';

- Jonathan

Last edited by:

jdgamble: Sep 30, 2006, 1:21 PM
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
Thanks for your reply.

I know so little about CGI programming that I'm getting lost when I'm not following instructions. PHP is fine, and .phtml sounds interesting. Could you show me what the new version of the sub (and any other mods) might look like modified please? Sorry to be a pain! ;-)

Last edited by:

Red5: Sep 30, 2006, 2:36 PM
Quote Reply
Re: [Red5] Auth_vBulletin and Authentication In reply to
Everything else would be the same. The sub would look like this:

Code:

sub {
my $output;

if ($ENV{SCRIPT_NAME} =~ /nph-build/) {
$output = '<? virtual("/cgi-bin/log.cgi"); ?>';
}
else {
$output = Links::SiteHTML::display('include_login');

}
return $output;

}


I realized include wouldn't work for a script, so virtual will do. Goto Setup->Build Options and change your build_index and build extension to ".phtml" instead of ".shtml" or "html" and or "index.shtml" etc.

- Jonathan
Quote Reply
Re: [jdgamble] Auth_vBulletin and Authentication In reply to
Thanks for the help.

So, as I have an established directory, I'd need to use the .htaccess mod_rewrite function to serve .phtml files (via a 301 redirect) when the old .html files are requested. ;-)
Quote Reply
Re: [Red5] Auth_vBulletin and Authentication In reply to
I couldn't get this to work in the end, so I have removed it. Thanks for your assistance though.

I would still like some official feedback on whether the broken plugin will be fixed, since it is still listed in the plugin manager. Is there an update planned please?
> >