View Single Post
  #4  
Old 01-15-2005, 03:22 AM
hurrican hurrican is offline
 
Join Date: Feb 2004
Posts: 76
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is the script that I am currently using.. Anyone see why this code would not pass the password to the Raidersoft server?? Should I be using $md5password in the chatbit template??? I have tested that too, but it still will not auth.. any help is greatly appreciated!

PHP Code:
<?php

/*
   SigmaChat Authentication Script v1.0
   Tested with vBulletin 2.3.0, SigmaChat Platinum 7.1
   Copyright (C) 2003, RaiderSoft. All Rights Reserved.

   This script allows you to authenticate access to your SigmaChat
   Java Chat room via a vBulletin MySQL database.

   Place this file in the same directory as your vBulletin config.php
   file (usually /upload/admin/)

   This software is free for commercial, non-profit, and individual use.

   Please read included README.txt file for installation instructions.

   RaiderSoft Support Team
   support@raidersoft.com
*/

require_once('../admin/config.php');

$username dbparam("username");
$password dbparam("password");
$ip param("ip");

$usergroupid = -1;
$retval 0;

header('Content-type: text/plain');

db_connect();

$md5password md5($password);

$query1 "SELECT usergroupid FROM user WHERE username='$username' AND PASSWORD='$md5password'";
$result mysql_query($query1$dbcxn);
if(
$row mysql_fetch_row($result))
{
   
$usergroupid $row[0];
   @
mysql_free_result($result);

   
$query2 "SELECT canpostnew, cancontrolpanel FROM usergroup WHERE usergroupid=$usergroupid";
   
$result mysql_query($query2$dbcxn);
   if(
$row mysql_fetch_row($result))
   {
      
$canpostnew int($row[0]);
      
$cancontrolpanel int($row[1]);


      if(
$canpostnew 0) { $retval 1; }
      if(
$cancontrolpanel 0) { $retval 2; }
   }
}

echo 
"$retval\n";
db_disconnect();


/*
   Database Related Functions...
*/

function db_connect()
{
   global 
$dbcxn;
   global 
$servername$dbusername$dbpassword$dbname;

   if(!(
$dbcxn mysql_connect($servername$dbusername$dbpassword)))
      
dferror("db_connect:mysql_connect");

   if(!(
mysql_select_db("$dbname"$dbcxn)))
      
auth_error("Error connecting to database.");
}

function 
db_disconnect()
{
   global 
$dbcxn;

   @
mysql_close($dbcxn);
}

function 
db_executeQuery($query)
{
   global 
$dbcxn;

   
$result mysql_query($query$dbcxn);
   @
mysql_free_result($result);
}

function 
auth_error($errorstr)
{
   echo 
$errorstr;
}

/*
   CGI, Misc.. Related Functions...
*/

function param($cgiparam)
{
   
$value = isset($_POST[$cgiparam])
            ? 
$_POST[$cgiparam]
            : 
$_GET[$cgiparam];

   return 
ini_get('magic_quotes_gpc')
          ? 
stripslashes($value)
          : 
$value;
}

function 
dbparam($cgiparam)
{
   
$value = isset($_POST[$cgiparam])
            ? 
$_POST[$cgiparam]
            : 
$_GET[$cgiparam];

   return 
$value;
}

function 
int($strval)
{
   return 
intval($strval);
}

?>
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01089 seconds
  • Memory Usage 1,810KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)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)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete