I keep getting a fatal error:Fatal error:
Code:
Fatal error: Registry object is not an object in [path]/includes/class_dm.php on line 205
I slightly modified the code above:
Main Code
Code:
<?php
mysql_connect($DBhost, $DBuser, $DBpass) or die(mysql_error());
mysql_select_db($DBname) or die(mysql_error());
$RegAllowArray = mysql_query("SELECT * FROM setting WHERE varname = 'allowregistration'") or die(mysql_error());
$RegAllow = mysql_fetch_array($RegAllowArray);
$CountUserArray = mysql_query("SELECT COUNT(*) FROM user") or die(mysql_error());
$CountUser = mysql_num_rows($CountUserArray);
if($CountUser < 50)
{
if($RegAllow['value'] != 0)
{
function register_in_vb($username, $password, $email, $day, $month, $year)
{
define('VB_AREA', 'External');
define('SKIP_SESSIONCREATE', 0);
define('SKIP_USERINFO', 1);
require_once('/home/shininga/public_html/divineshadowsonline/forum/includes/init.php');
require_once('/home/shininga/public_html/divineshadowsonline/forum/includes/functions_misc.php');
$registry = $vbulletin;
unset($vbulletin);
$vbDb = $registry->db;
//declare as global vbulletin's registry and db objects
global $vbulletin,$db;
$vbulletin = $registry;
//backup the original $db object (new!!)
$backupdb = $db;
$db = $vbDb;
$newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
$newuser->set('username', $username);
$newuser->set('email', $email);
$newuser->set('password', $password);
$newuser->set('usergroupid', 2);
$newuser->set('displaygroupid', 2);
$newuser->set('birthday', array($month, $day, $year));
$newuser->pre_save();
if(empty($newuser->errors)){
$db = $backupdb;
echo 1;
return $newuser->save();
}else{
$db = $backupdb;
echo 0;
print_r( $newuser->errors);
include("/home/shininga/public_html/divineshadowsonline/includes/register-form.php");
}
}
if(!$logged_in) {
if(isset($_POST['username']))
{
$key = $_POST['key'];
$username = $_POST['username'];
$password = $_POST['password'];
$confirmpass = $_POST['confirmpass'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$email = $_POST['email'];
$tos = $_POST['tos'];
include("/home/shininga/public_html/divineshadowsonline/includes/register-functions.php");
$newuserid = register_in_vb($username, $password, $email, $day, $month, $year);
} else if(!isset($_POST['username'])) {
include("/home/shininga/public_html/divineshadowsonline/includes/register-form.php");
}
} else {
echo "<h4><center><b>You are already logged in!</b></center></h4>";
}
} else {
echo "<center>Registration Are Currently Disabled</center>";
}
} else {
echo "<center>Registration Are Currently Disabled</center>";
}
mysql_close();
?>
I could really use some help please. :P