Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Deluxe vB User login and access control on non vB pages Details »»
Deluxe vB User login and access control on non vB pages
Version: 2.20, by Billspaintball Billspaintball is offline
Developer Last Online: Nov 2011 Show Printable Version Email this Page

Version: 3.5.8 Rating:
Released: 02-14-2006 Last Update: 04-23-2007 Installs: 223
Additional Files  
No support by the author.

Hack Description

This is the deluxe version of the user authentication and access control system I use on the non vB pages on my website.
For the simple no frills version look here.

This uses the vB 3.5 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 displying to non members only, and/or let members access to specific content.

It also displays the logged in users Avatar, number of unread PM's, New posts since last visit, total posts and total threads.
It also allows you to specify a maximum Avatar size, and resize any avatars larger than that, while keeping their height/width ratios in proportion!
Its very handy if you allow large avatars, but want a small format display on your non forum pages.

If the user is not logged in, a login box is displayed, along with total posts and total threads in the forums.

I will try and offer support, but work and family commitments mean I dont 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 is a work in progress and currently a beta version. It was a little rushed as a few people were pushing for it Its missing a couple of planned things like newest member etc, but they will be added in a later version.

This script has been confirmed as working on
  • vB 3.5.x - All Versions
  • vB 3.6.x - All Versions

Known Bugs
Will not display Avatars correctly if they are kept in the file system (database avatars are fine)

Changelog

Version 2.20 (24th April 2007)
  • Fixed - // in paths bug
  • Fixed - Javascript warning in some browsers
  • Fixed - Tidied up some code
  • Fixed - Avatar display code bug

Version 2.10 (4th June 2006)
  • Fixed - "MySQL Error : Invalid SQL " when using Database thread/forum marking.
  • Fixed - Javascrip error in some versions of IE.

Version 2.00 (16th April 2006)
  • Fixed - "MySQL Error : Unknown column 'newposts' in 'field list' "
  • Fixed - Number of PM's not displaying in all installs.
  • Added - Displays date and time of last login.
  • Added - Total number of saved PM's.
To upgrade just overwrite the existing login_inc.php file with the new one.
You will need to re-edit the path on line 3 and also redo any formatting changes you may have done for the last version.

Version 1.0 (15th Feb 2006)
  • Initial Release


Click on Install
If you have this script installed then please click on the install link because;
  • You will get notified if any security issues are reported.
  • You will get notified when there are any upgrades to this script
  • It gives me a warm fuzzy feeling and motivates me to develop more

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #312  
Old 05-01-2007, 05:04 PM
CSGCarl CSGCarl is offline
 
Join Date: Feb 2007
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It's me again lol

Thanks for that I did that and worked fine til I tried it on a menu...

When I tried it on menu I got these errors;
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/---/public_html/homepage.php on line 928

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/---/public_html/homepage.php on line 928

This is the code which I tried:

PHP Code:
<?php
If ($vbulletin->userinfo['userid']!=0)

echo \?<
img src=\\?<td style=\?background-image:url('http://www.battlestationextreme.com/images/homepage09.jpg'); height:40px\?>

                                            <table width=\?181\? border=\?0\? cellspacing=\?0\? cellpadding=\?0\? id=\?table16\?>



                                                    <tr>



                                                        <td width=\?15\?><img src=\?http://www.battlestationextreme.com/images/spacer.gif\? alt=\?\? width=\?15\? height=\?40\?></td>



                                                        <td width=\?166\? class=\?text2\?>

                                                        My BSE</td>



                                                    </tr>



                                                </table></td>



                                        </tr>



                                        <tr>



                                            <td style=\?background-image:url('http://www.battlestationextreme.com/images/homepage10.jpg'); height:29px\?>

                                            <table width=\?100%\? border=\?0\? cellspacing=\?0\? cellpadding=\?0\? id=\?table17\?>



                                                    <tr>



                                                        <td width=\?8%\?><img src=\?http://www.battlestationextreme.com/images/spacer.gif\? alt=\?\? width=\?15\? height=\?29\?></td>



                                                        <td width=\?92%\?>

                                                        <a class=\?link1\? href=\?http://www.battlestationextreme.com/forums/usercp.php\?>

                                                        My Account</a></td>



                                                    </tr>



                                                </table></td>



                                        </tr>



                                        <tr>



                                            <td style=\?background-image:url('http://www.battlestationextreme.com/images/homepage10.jpg'); height:29px\?>

                                            <table width=\?100%\? border=\?0\? cellspacing=\?0\? cellpadding=\?0\? id=\?table18\?>



                                                    <tr>



                                                        <td width=\?8%\?><img src=\?http://www.battlestationextreme.com/images/spacer.gif\? alt=\?\? width=\?15\? height=\?29\?></td>



                                                        <td width=\?92%\?>

                                                        <a class=\?link1\? href=\?http://www.battlestationextreme.com/forums/private.php\?>

                                                        My Messages</a></td>



                                                    </tr>



                                                </table></td>



                                        </tr>



                                        <tr>



                                            <td style=\?background-image:url('http://www.battlestationextreme.com/images/homepage10.jpg'); height:29px\?>

                                            <table width=\?100%\? border=\?0\? cellspacing=\?0\? cellpadding=\?0\? id=\?table19\?>



                                                    <tr>



                                                        <td width=\?8%\?><img src=\?http://www.battlestationextreme.com/images/spacer.gif\? alt=\?\? width=\?15\? height=\?29\?></td>



                                                        <td width=\?92%\?>

                                                        <a class=\?link1\? href=\?http://help.battlestationextreme.com/ticket/index.php?a=add\?>

                                                        New Ticket</a></td>



                                                    </tr>



                                                </table></td>



                                        </tr>



                                        <tr>



                                            <td style=\?background-image:url('http://www.battlestationextreme.com/images/homepage10.jpg'); height:29px\?>

                                            <table width=\?100%\? border=\?0\? cellspacing=\?0\? cellpadding=\?0\? id=\?table20\?>



                                                    <tr>



                                                        <td width=\?8%\?><img src=\?http://www.battlestationextreme.com/images/spacer.gif\? alt=\?\? width=\?15\? height=\?29\?></td>



                                                        <td width=\?92%\?>

                                                        <a class=\?link1\? href=\?http://help.battlestationextreme.com/ticket/ticket.php?track\?>

                                                        View Tickets</a></td>



                                                    </tr>



                                                </table></td>



                                        </tr>



                                        <tr>



                                            <td><img src=\?http://www.battlestationextreme.com/images/homepage11.jpg\? alt=\?\? width=\?181\? height=\?8\?></td>\?;
} else {
echo \?Your not logged in so we display this\?;
}
?>
I'm not much good at this but once you tell me the problem I should be sorted:erm:

Carl
Reply With Quote
  #313  
Old 05-01-2007, 10:46 PM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Carl.

Looks like you have missed using \ in a few places.

For example near the top you have

PHP Code:

echo &#8221;<img src=”<td style=”background-image:url('http://www.battlestationextreme.com/images/homepage09.jpg'); height:40px”> 
but it should be
PHP Code:
 
echo &#8221;<img src=\”<td style=\”background-image:url(\"http://www.battlestationextreme.com/images/homepage09.jpg\"); height:40px\”> 
Then you have

PHP Code:
 
<table width=&#8221;181” border=”0” cellspacing=”0” cellpadding=”0” id=”table16”> 
but it should be
PHP Code:
 
<table width=\&#8221;181\” border=\”0\” cellspacing=\”0\” cellpadding=\”0\” id=\”table16\”> 
and so on for the rest...

If you dont escape every " that is in your HTML inside the echo statement with \ it will cause a premature end to the echo statement and wont work.
Reply With Quote
  #314  
Old 05-06-2007, 12:31 PM
CSGCarl CSGCarl is offline
 
Join Date: Feb 2007
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok well I have looked and replaced all the " with \" but I still seem to get errors for example:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/----/public_html/homepage.php on line 1039

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/----/public_html/homepage.php on line 1039

PHP Code:
<?php If ($vbulletin->userinfo["userid"]!=0)
    {    
    echo \&
#8221;<td style=\”background-image:url(\”http://www.battlestationextreme.com/images/homepage09.jpg\”); height:40px\”>

                                            
<table width=\&#8221;181\” border=\”0\” cellspacing=\”0\” cellpadding=\”0\” id=\”table28\”>



                                                    
<tr>



                                                        <
td width=\&#8221;15\”><img src=\”http://www.battlestationextreme.com/images/spacer.gif\” alt=\”\” width=\”15\” height=\”40\”></td>



                                                        
<td width=\&#8221;166\” class=\”text2\”>

                                                        
My BSE</td>



                                                    </
tr>



                                                </
table></td>



                                        </
tr>



                                        <
tr>



                                            <
td style=\&#8221;background-image:url(\”http://www.battlestationextreme.com/images/homepage10.jpg\”); height:29px\”>

                                            
<table width=\&#8221;100%\” border=\”0\” cellspacing=\”0\” cellpadding=\”0\” id=\”table29\”>



                                                    
<tr>



                                                        <
td width=\&#8221;8%\”><img src=\”http://www.battlestationextreme.com/images/spacer.gif\” alt=\”\” width=\”15\” height=\”29\”></td>



                                                        
<td width=\&#8221;92%\”>

                                                        
<class=\&#8221;link1\” href=\”http://www.battlestationextreme.com/forums/usercp.php\”>

                                                        
Register!</a></td>



                                                    </
tr>



                                                </
table></td>



                                        </
tr>



                                        <
tr>



                                            <
td style=\&#8221;background-image:url(\”http://www.battlestationextreme.com/images/homepage10.jpg\”); height:29px\”>

                                            
<table width=\&#8221;100%\” border=\”0\” cellspacing=\”0\” cellpadding=\”0\” id=\”table30\”>



                                                    
<tr>



                                                        <
td width=\&#8221;8%\”><img src=\”http://www.battlestationextreme.com/images/spacer.gif\” alt=\”\” width=\”15\” height=\”29\”></td>



                                                        
<td width=\&#8221;92%\”>

                                                        
<class=\&#8221;link1\” href=\”http://www.battlestationextreme.com/forums/private.php\”>

                                                        
Login</a></td>



                                                    </
tr>



                                                </
table></td>



                                        </
tr>



                                        <
tr>



                                            <
td><img src=\&#8221;http://www.battlestationextreme.com/images/homepage11.jpg\” alt=\”\” width=\”181\” height=\”8\”></td>



                                        
</tr>



                                    </
table>\&#8221;;
    
} else {
    echo \&
#8221;Your not logged in so we display this\”;
    
}
?>


I take it this is right?
PHP Code:
<?php If ($vbulletin->userinfo["userid"]!=0)
Cheers,
Carl
Reply With Quote
  #315  
Old 05-07-2007, 01:12 AM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Carl,
I should have been a little clearer.
You need to escape the " that are part of the HTML code, not the " that are part of the PHP code.

Quote:
Originally Posted by CSGCarl View Post
Ok well I have looked and replaced all the " with \" but I still seem to get errors for example:

.........

Code:
<?php If ($vbulletin->userinfo["userid"]!=0)
	{	
	echo \”<td style=\”background-image:url(\”http://www.battlestationextreme.com/images/homepage09.jpg\”); height:40px\”>

............................................................																</table>\”;
	} else {
	echo \”Your not logged in so we display this\”;
	}
?>

Should be

Code:
<?php If ($vbulletin->userinfo["userid"]!=0)
	{	
	echo ”<td style=\”background-image:url(\”http://www.battlestationextreme.com/images/homepage09.jpg\”); height:40px\”>

............................................................																</table>”;
	} else {
	echo ”Your not logged in so we display this”;
	}
?>
Quote:
I take it this is right?
PHP Code:
<?php If ($vbulletin->userinfo["userid"]!=0)
Yes thats ok, thats part of the PHP code so dont escape them.


Hope that all makes sense
Reply With Quote
  #316  
Old 05-07-2007, 11:56 AM
Gooses Gooses is offline
 
Join Date: May 2006
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow, I love it! Thank you very much for making this.
Reply With Quote
  #317  
Old 05-08-2007, 10:02 AM
TheAlchemist TheAlchemist is offline
 
Join Date: May 2007
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ok......I have saved the following in a test.php file located in my website root (local machine)

Code:
<?php
$curdir = getcwd ();
chdir('c:\inetpub\wwwroot\tradinglab\forums');
require_once('c:\inetpub\wwwroot\tradinglab\forums\global.php');
chdir ($curdir);
?>
<html> 
<body> 
This is a heading<br /> 
This is some more stuff <br /> 
And another line<br /> 
You get the idea<br /> 
Just place stuff as you normally would with HTML<br /> 
I use CSS to style and position on my site fwiw<br /> 
<br /> 
How about we put the login box right under here?<br /> 
<br /> 
<?php 
    require_once('c:\inetpub\wwwroot\tradinglab\login_inc.php'); 
?> 
</body> 
</html>
when I run the script this is what I get:

Code:
Notice: Undefined index: REQUEST_URI in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1952

Notice: Undefined index: REQUEST_URI in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1952

Notice: Undefined index: QUERY_STRING in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1971

Notice: Undefined index: QUERY_STRING in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1971

Notice: Undefined index: HTTP_REFERER in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1602



Unable to add cookies, header already sent.
File: c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php
Line: 1952
can someone help me iron this thing out? thanks in advance
Reply With Quote
  #318  
Old 05-08-2007, 11:45 AM
Billspaintball's Avatar
Billspaintball Billspaintball is offline
 
Join Date: Sep 2003
Location: Bathurst, Au
Posts: 649
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TheAlchemist View Post

when I run the script this is what I get:

Code:
Notice: Undefined index: REQUEST_URI in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1952

Notice: Undefined index: REQUEST_URI in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1952

Notice: Undefined index: QUERY_STRING in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1971

Notice: Undefined index: QUERY_STRING in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1971

Notice: Undefined index: HTTP_REFERER in c:\inetpub\wwwroot\tradinglab\forums\includes\class_core.php on line 1602
That error is from a vB file that we dont touch. Its called by vB's global.php file (I think).
I would hazard a guess that its something to do with a server setting, or possibly your cookie path setting in your vB control panel.

Quote:
Unable to add cookies, header already sent.
File: c:\inetpub\wwwroot\tradinglab\forums\includes\clas s_core.php
Line: 1952
This error is usually caused by whitespace before
PHP Code:
<?php
$curdir 
getcwd ();
chdir('c:\inetpub\wwwroot\tradinglab\forums');
require_once(
'c:\inetpub\wwwroot\tradinglab\forums\global.php');
chdir ($curdir);
?>
however in this case it could well be caused by your initial problem.
Reply With Quote
  #319  
Old 05-08-2007, 12:53 PM
TheAlchemist TheAlchemist is offline
 
Join Date: May 2007
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you are definetly right. I installed Vb on a live server, uploaded your hack and it works like a charm. thank you very much!!!!
Reply With Quote
  #320  
Old 05-15-2007, 01:13 PM
CypherSTL CypherSTL is offline
 
Join Date: Mar 2006
Location: St. Charles, MO
Posts: 306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First of all, great hack.

I am having one issue though.

Code:
Warning: getimagesize() [function.getimagesize]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/ulancom/public_html/modules/login_vB36.php on line 34

Warning: getimagesize(http://www.unreallan.com/forums/image.php?u=1) [function.getimagesize]: failed to open stream: Success in /home/ulancom/public_html/modules/login_vB36.php on line 34
Any ideas why it would be doing this?
Reply With Quote
  #321  
Old 05-15-2007, 07:21 PM
CSGCarl CSGCarl is offline
 
Join Date: Feb 2007
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey,

I'm still having a problem I've fixed other but...

Code:


Code:
Code:
<?php
If ($vbulletin->userinfo['userid']!=0)
	{	
	echo "<td style=\"background-image:url(\'http://www.battlestationextreme.com/images/homepage09.jpg\'); height:40px\">

											<table width=\"181\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"table28\">



													<tr>



														<td width=\"15\"><img src=\"http://www.battlestationextreme.com/images/spacer.gif\" alt=\"\" width=\"15\" height=\"40\"></td>



														<td width=\"166\" class=\"text2\">

														My BSE</td>



													</tr>



												</table></td>



										</tr>



										<tr>



											<td style=\"background-image:url(\'http://www.battlestationextreme.com/images/homepage10.jpg\'); height:29px\">

											<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"table29\">



													<tr>



														<td width=\"8%\"><img src=\"http://www.battlestationextreme.com/images/spacer.gif\" alt=\"\" width=\"15\" height=\"29\"></td>



														<td width=\"92%\">

														<a class=\"link1\" href=\"http://www.battlestationextreme.com/forums/usercp.php\">

														Register!</a></td>



													</tr>



												</table></td>



										</tr>



										<tr>



											<td style=\"background-image:url(\'http://www.battlestationextreme.com/images/homepage10.jpg\'); height:29px\">

											<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" id=\"table30\">



													<tr>



														<td width=\"8%\"><img src=\"http://www.battlestationextreme.com/images/spacer.gif\" alt=\"\" width=\"15\" height=\"29\"></td>



														<td width=\"92%\">

														<a class=\"link1\" href=\"http://www.battlestationextreme.com/forums/private.php\">

														Login</a></td>



													</tr>



												</table></td>\";
	} else {
	echo "Your not logged in so we display this";
	}
?>
Error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/-----/public_html/homepage.php on line 1016

And line 1016 is:


Code:
Code:
echo "Your not logged in so we display this";
I can't see whats wrong there.

If some one could help me out this would be great.


Regards,

Carl
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:05 AM.


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.11712 seconds
  • Memory Usage 2,426KB
  • Queries Executed 25 (?)
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
  • (8)bbcode_code
  • (9)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete