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

Reply
 
Thread Tools
user session authication Details »»
user session authication
Version: 1.00, by mic2100 mic2100 is offline
Developer Last Online: Aug 2007 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.6.5 Rating:
Released: 05-25-2007 Last Update: Never Installs: 3
 
No support by the author.

hi,

I was trying to build a member area for my site and wanted to use the vbulliten login system for all the areas on my site, so I have written this code:

PHP Code:

//this is the connection string to the database where the vbulliten table are.
require_once('../Connections/conn_nadea.php');

//this code will allow viewing of a page if a user is currently logged into the 
//vbulletin forum and is not a guest user. if it detects that no user is logged
//in it will automatically send you to the forum home page where you can login
//or register as a new user.

$colname_rs_userid "-1";
if (isset(
$_COOKIE['bbsessionhash'])) {
  
$sessionid = (get_magic_quotes_gpc()) ? $_COOKIE['bbsessionhash'] : addslashes($_COOKIE['bbsessionhash']);
}
mysql_select_db($database_conn_nadea$conn_nadea);
$sql sprintf("SELECT userid FROM session WHERE sessionhash = '%s'"$sessionid);
$rs_userid mysql_query($sql$conn_nadea);
$row mysql_fetch_assoc($rs_userid);
$totalRows mysql_num_rows($rs_userid);

if(
$totalRows == and $row['userid'] == 0)
{

    
//this navigates to the forum login page
    
header('Location: ../forum/login.php');
    
    
mysql_free_result($rs_userid);

}
else
{

    
//this is where you page content should go.
    
echo "Page Content!!!";
    
    
mysql_free_result($rs_userid);
    

This will authicate any user that trys to access any page that you want protecting, if they are not currently logged into the forum then it will re-direct them to the forum. All you need to do is use this code at the top of the protected pages.

Hopfully this may be useful for somebody.

Show Your Support

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

Comments
  #2  
Old 05-26-2007, 06:58 AM
Robru Robru is offline
 
Join Date: Aug 2005
Location: Netherlands
Posts: 368
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for this solution
Reply With Quote
  #3  
Old 05-26-2007, 07:00 AM
amnesia623 amnesia623 is offline
 
Join Date: Jul 2006
Location: Glendale, AZ
Posts: 226
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

uhh...yah it will be useful!!!

thanks!
Reply With Quote
  #4  
Old 05-26-2007, 02:39 PM
Milad's Avatar
Milad Milad is offline
 
Join Date: Apr 2005
Location: Syro
Posts: 663
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This can be done better by including gloabal.php in your file. I think.
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 08:35 PM.


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.03588 seconds
  • Memory Usage 2,233KB
  • Queries Executed 17 (?)
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
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (4)postbit_onlinestatus
  • (4)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete