Back to vBulletin 3.6 Add-ons

user session authication
Mod Version: 1.00, by mic2100

This modification is in the archives.
vB Version: 3.6.5 Rating: (1 vote - 5.00 average) Installs: 3
Released: 26 May 2007 Last Update: Never Downloads: 2
Not Supported  

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.

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2025