Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 07-19-2006, 09:38 PM
maximux1's Avatar
maximux1 maximux1 is offline
 
Join Date: Mar 2002
Posts: 89
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Sigma Chat Premium +vB user integration

Hey guys,

I've recently upgraded my network of sites up to the vB3.6 branch, getting ready to re-release the sites and I've run into a problem that I could use some assistance with.

I have a premium account with Sigma Chat and I am trying to edit their chat_auth.php file to allow integration with my user database. I will include the entire chat_auth.php file (which resides in the forum root directory).

From the Sigma Chat help resources;
Quote:
The AAS (remote access system) allows you to perform username/password verification from your own web site. This is performed by hosting a script on your own website (using CGI, PHP, ASP, or similar) that accepts two parameters; a username, and a password; and returns a simple zero (denying access) or 1 (to accept access).
Here's an example of a remote call -
HTML Code:
http://www.mywebsite/verify.pl?username=JAVAMAN&password=FOXTROT&ip=01.029.95.25
Here's the chat_auth.php file;

PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # SigmaChat Authentication module for vBulletin 3                  # ||
|| # ---------------------------------------------------------------- # ||
|| # Version: 1.1                                                     # ||
|| # Author: Oleg Krogius (olegk@cgshock.com)                         # ||
|| #################################################################### ||
\*======================================================================*/

/*
In order to install this all you need to do is drop this in the root folder
of your vBulletin 3 installation. :)

Important note: you may need to customize your banned usergroup ID.
You can find it on line 59 of this script, which reads:
" if ( $bbuserinfo['usergroupid'] == 45 ) "
Just change the number 8 to another one, if needed.
*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('SESSION_BYPASS'1);
define('LOCATION_BYPASS'1);
define('THIS_SCRIPT''chat_auth');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array();
$specialtemplates = array();
$globaltemplates = array();
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(
'./includes/functions_legacy.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
globalize($_GET, array('username' => STR,'password' => STR));

if (
$username == '')
{

    die(
'0');
}

// get userid for given username

if ($bbuserinfo $DB_site->query_first('SELECT userid, usergroupid, membergroupids, username, password, salt FROM ' TABLE_PREFIX 'user 
    WHERE username = "' 
addslashes(htmlspecialchars_uni($username)) . '"'))
{
    if (
$bbuserinfo['password'] != md5(md5($password) . $bbuserinfo['salt']))
    {
        
//bad password
        
die('0');
    }
    else
    {
        
//is user activated?
        
if ( $bbuserinfo['usergroupid'] == || $bbuserinfo['usergroupid'] == 
        {
            die(
'0');
        }

        
//is user banned?
        
if ( $bbuserinfo['usergroupid'] == 
        {
            die(
'0');
        }

        
//is the user an admin / super mod?
        
if ( $bbuserinfo['usergroupid'] == || $bbuserinfo['usergroupid'] == 
        {
            die(
'2');
        }

        
//user is regular user
        
die('1');
    }
}
else
{
    
//bad username
    
die('0');
}

?>
The following error is reported when running the above script;

Quote:
Fatal error: Call to a member function on a non-object in /home/final/public_html/420/chat_auth.php on line 52
Again, im trying to adapt this to work with vB3.6x. The script works fine with vB 3.5x.

Any insight would be greatly apprecaited!

Thanks!
Max

I have completed the necessary changes to the sigma chat integration script to make it work with vB3.6. The main change was with the way the data was being called. The old script was using a deprecated db function from vB. I updated that and had to include the functinos_legacy.php files to allow for globalize() to initialize.

Here's the final script. Just drop this in your vB root directory and in your Sigma Chat account settings point to this script for vB user authentication.

PHP Code:
<?php
/*======================================================================*\
|| #################################################################### ||
|| # SigmaChat Authentication module for vBulletin 3                  # ||
|| # ---------------------------------------------------------------- # ||
|| # Version: 1.1                                                                          # ||
|| # Author: Oleg Krogius (olegk@cgshock.com)                         # ||
||  07-20-7 - updated script to work with vB3.6 by Maximux1 & vB.org
|| #################################################################### ||
\*======================================================================*/

/*
In order to install this all you need to do is drop this in the root folder
of your vBulletin 3 installation. :)

Important note: you may need to customize your banned usergroup ID.
You can find it on line 59 of this script, which reads:
" if ( $bbuserinfo['usergroupid'] == 45 ) "
Just change the number 8 to another one, if needed.
*/

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('SESSION_BYPASS'1);
define('LOCATION_BYPASS'1);
define('THIS_SCRIPT''chat_auth');

// ################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array();
$specialtemplates = array();
$globaltemplates = array();
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(
'./includes/functions_legacy.php');


// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
globalize($_GET, array('username' => STR,'password' => STR));


if (
$username == '')
{
    die(
'0');
}

// get userid for given username  
$bbuserinfo $db->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE username = '$username'");    

    if (
$bbuserinfo['password'] != md5(md5($password) . $bbuserinfo['salt']))
    {
        
//bad password
        
die('0');
    }
    else
    {
        
//is user activated?
        
if ( $bbuserinfo['usergroupid'] == || $bbuserinfo['usergroupid'] == 
        {
            die(
'0');
        }

        
//is user banned?
        
if ( $bbuserinfo['usergroupid'] == 
        {
            die(
'0');
        }

        
//is the user an admin / super mod?
        
if ( $bbuserinfo['usergroupid'] == || $bbuserinfo['usergroupid'] == 
        {
            die(
'2');
        }

        
//user is regular user
        
die('1');
    }

?>
Reply With Quote
Reply

Thread Tools
Display Modes

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:15 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.06119 seconds
  • Memory Usage 2,268KB
  • Queries Executed 11 (?)
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_html
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.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_threaded
  • showthread_threaded_construct_link
  • 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