<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.8.11 - Licence Number VBFD291AA6
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000-2025 vBulletin Solutions Inc. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| #        www.vbulletin.com | www.vbulletin.com/license.html        # ||
|| #################################################################### ||
\*======================================================================*/

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

// #################### DEFINE IMPORTANT CONSTANTS #######################
define(&#039;THIS_SCRIPT&#039;, &#039;register&#039;);
define(&#039;CSRF_PROTECTION&#039;, true);

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(&#039;timezone&#039;, &#039;user&#039;, &#039;register&#039;, &#039;cprofilefield&#039;);

// get special data templates from the datastore
$specialtemplates = array(
	&#039;smiliecache&#039;,
	&#039;bbcodecache&#039;,
	&#039;banemail&#039;,
	&#039;ranks&#039;,
);

// pre-cache templates used by all actions
$globaltemplates = array(
	&#039;humanverify&#039;,
	&#039;register&#039;,
	&#039;register_rules&#039;,
	&#039;register_verify_age&#039;,
	&#039;register_coppaform&#039;,
	&#039;userfield_textbox&#039;,
	&#039;userfield_checkbox_option&#039;,
	&#039;userfield_optional_input&#039;,
	&#039;userfield_radio&#039;,
	&#039;userfield_radio_option&#039;,
	&#039;userfield_select&#039;,
	&#039;userfield_select_option&#039;,
	&#039;userfield_select_multiple&#039;,
	&#039;userfield_textarea&#039;,
	&#039;userfield_wrapper&#039;,
	&#039;modifyoptions_timezone&#039;,
	&#039;modifyprofile_birthday&#039;,
);

// pre-cache templates used by specific actions
$actiontemplates = array(
	&#039;requestemail&#039; => array(
		&#039;activate_requestemail&#039;
	),
	&#039;none&#039; => array(
		&#039;activateform&#039;
	)
);

// ######################### REQUIRE BACK-END ############################
require_once(&#039;./global.php&#039;);
require_once(DIR . &#039;/includes/functions_user.php&#039;);
require_once(DIR . &#039;/includes/functions_misc.php&#039;);

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$vbulletin->input->clean_gpc(&#039;r&#039;, &#039;a&#039;, TYPE_NOHTML);
$vbulletin->input->clean_gpc(&#039;r&#039;, &#039;u&#039;, TYPE_NOHTML);
$coppaage = $vbulletin->input->clean_gpc(&#039;c&#039;, COOKIE_PREFIX . &#039;coppaage&#039;, TYPE_STR);

if (empty($_REQUEST[&#039;do&#039;]) AND $vbulletin->GPC[&#039;a&#039;] == &#039;&#039;)
{
	$_REQUEST[&#039;do&#039;] = &#039;signup&#039;;
}

($hook = vBulletinHook::fetch_hook(&#039;register_start&#039;)) ? eval($hook) : false;

// ############################### start checkdate ###############################
if ($_REQUEST[&#039;do&#039;] == &#039;checkdate&#039;)
{
	// check their birthdate
	$vbulletin->input->clean_array_gpc(&#039;r&#039;, array(
		&#039;month&#039; => TYPE_UINT,
		&#039;year&#039;  => TYPE_UINT,
		&#039;day&#039;   => TYPE_UINT,
	));

	$current[&#039;year&#039;] = date(&#039;Y&#039;);
	$current[&#039;month&#039;] = date(&#039;m&#039;);
	$current[&#039;day&#039;] = date(&#039;d&#039;);

	if ($vbulletin->GPC[&#039;month&#039;] == 0 OR $vbulletin->GPC[&#039;day&#039;] == 0 OR !preg_match(&#039;#^\d{4}$#&#039;, $vbulletin->GPC[&#039;year&#039;]) OR $vbulletin->GPC[&#039;year&#039;] < 1901 OR $vbulletin->GPC[&#039;year&#039;] > $current[&#039;year&#039;])
	{
		eval(standard_error(fetch_error(&#039;select_valid_dob&#039;, $current[&#039;year&#039;])));
	}

	($hook = vBulletinHook::fetch_hook(&#039;register_checkdate&#039;)) ? eval($hook) : false;

	if ($vbulletin->options[&#039;usecoppa&#039;] AND $vbulletin->options[&#039;checkcoppa&#039;] AND $coppaage)
	{
		$dob = explode(&#039;-&#039;, $coppaage);
		$month = $dob[0];
		$day = $dob[1];
		$year = $dob[2];
	}

	if ($vbulletin->GPC[&#039;year&#039;] < 1970 OR (mktime(0, 0, 0, $vbulletin->GPC[&#039;month&#039;], $vbulletin->GPC[&#039;day&#039;], $vbulletin->GPC[&#039;year&#039;]) <= mktime(0, 0, 0, $current[&#039;month&#039;], $current[&#039;day&#039;], $current[&#039;year&#039;] - 13)))
	{
		$_REQUEST[&#039;do&#039;] = &#039;signup&#039;;
	}
	else
	{
		if ($vbulletin->options[&#039;checkcoppa&#039;] AND $vbulletin->options[&#039;usecoppa&#039;])
		{
			vbsetcookie(&#039;coppaage&#039;, $vbulletin->GPC[&#039;month&#039;] . &#039;-&#039; . $vbulletin->GPC[&#039;day&#039;] . &#039;-&#039; . $vbulletin->GPC[&#039;year&#039;], 1);
		}

		if ($vbulletin->options[&#039;usecoppa&#039;] == 2)
		{
			// turn away as they&#039;re under 13
			eval(standard_error(fetch_error(&#039;under_thirteen_registration_denied&#039;)));
		}
		else
		{
			$_REQUEST[&#039;do&#039;] = &#039;signup&#039;;
		}
	}
}

// ############################### start signup ###############################
if ($_REQUEST[&#039;do&#039;] == &#039;signup&#039;)
{
	$current[&#039;year&#039;] = date(&#039;Y&#039;);
	$current[&#039;month&#039;] = date(&#039;m&#039;);
	$current[&#039;day&#039;] = date(&#039;d&#039;);

	if (!$vbulletin->options[&#039;allowregistration&#039;])
	{
		eval(standard_error(fetch_error(&#039;noregister&#039;)));
	}

	if ($vbulletin->userinfo[&#039;userid&#039;] AND !$vbulletin->options[&#039;allowmultiregs&#039;])
	{
		eval(standard_error(fetch_error(&#039;alreadyregistered&#039;, $vbulletin->userinfo[&#039;username&#039;], $vbulletin->session->vars[&#039;sessionurl&#039;])));
	}

	if ($vbulletin->options[&#039;usecoppa&#039;])
	{
		if ($vbulletin->options[&#039;checkcoppa&#039;] AND $coppaage)
		{
			$dob = explode(&#039;-&#039;, $coppaage);
			$month = $dob[0];
			$day = $dob[1];
			$year = $dob[2];
		}
		else
		{
			$month = $vbulletin->input->clean_gpc(&#039;r&#039;, &#039;month&#039;, TYPE_UINT);
			$year = $vbulletin->input->clean_gpc(&#039;r&#039;, &#039;year&#039;, TYPE_UINT);
			$day = $vbulletin->input->clean_gpc(&#039;r&#039;, &#039;day&#039;, TYPE_UINT);
		}

		if (!$month OR !$day OR !$year)
		{	// Show age controls
			$templatename = &#039;register_verify_age&#039;;
		}
		else	// verify age
		{
			if ($year < 1970 OR (mktime(0, 0, 0, $month, $day, $year) <= mktime(0, 0, 0, $current[&#039;month&#039;], $current[&#039;day&#039;], $current[&#039;year&#039;] - 13)))
			{	// this user is >13
				$show[&#039;coppa&#039;] = false;
				$templatename = &#039;register_rules&#039;;
			}
			else if ($vbulletin->options[&#039;usecoppa&#039;] == 2)
			{
				if ($vbulletin->options[&#039;checkcoppa&#039;])
				{
					vbsetcookie(&#039;coppaage&#039;, $month . &#039;-&#039; . $day . &#039;-&#039; . $year, 1);
				}
				eval(standard_error(fetch_error(&#039;under_thirteen_registration_denied&#039;)));
			}
			else
			{
				if ($vbulletin->options[&#039;checkcoppa&#039;])
				{
					vbsetcookie(&#039;coppaage&#039;, $month . &#039;-&#039; . $day . &#039;-&#039; . $year, 1);
				}
				$show[&#039;coppa&#039;] = true;
				$templatename = &#039;register_rules&#039;;
			}
		}
	}
	else
	{
		$show[&#039;coppa&#039;] = false;
		$templatename = &#039;register_rules&#039;;
	}

	($hook = vBulletinHook::fetch_hook(&#039;register_signup&#039;)) ? eval($hook) : false;

	$url =& $vbulletin->url;
	eval(&#039;print_output("&#039; . fetch_template($templatename) . &#039;");&#039;);
}

Add a code snippet to your website: www.paste.org