The Arcive of vBulletin Modifications Site. | 
    |
| 
		 
			 
			#1  
			
			
			
			
			
		 
		
	 | 
||||
		
		
  | 
||||
| 
		
	
		
		
			
			 
			
			Article URL: https://vborg.vbsupport.ru/showthrea...reate+New+User 
		
		
		
		
		
		
		
		
	
	Forum URL: http://www.forum.divineshadowsonline.com/ Forum Version: 4.1.8 I found this article a few days ago as I was looking for a way to use vB's internal registration system from an external page, but I keep getting a fatal error: Code: 
	Fatal error: Registry object is not an object in [path]/includes/class_dm.php on line 205 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();
?>
--------------- Added [DATE]1323255563[/DATE] at [TIME]1323255563[/TIME] --------------- Can anyone help me please? I really would rather use the internal systems to add users to the database so that everything runs through the error handle and stuff. It would be a royal pain in the but to rebuild every single one of the error handles in order to check if the information is valid.  | 
![]()  | 
	
	
		
  | 
	
		
  | 
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
						
  | 
				|
  More Information | 
				|
| 
						 Template Usage: 
						
 Phrase Groups Available: 
						
  | 
					
						 Included Files: 
						
 Hooks Called: 
						
  |