<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////
// BotBanish 9.0.00
// Randem Systems: https://randemsystems.support
// BotBanish Registration Protection
// Date: 06/19/2026
// Usage: BotBanish_RegisterAccount.php
//		Use with hidden field from inside HTML code on Registration Pages where real users cannot
//		possibly enter text in the hidden field.
//
///////////////////////////////////////////////////////////////////////////////////////////////////////

	// Load BotBanish settings information

	$path = substr($_SERVER['SCRIPT_FILENAME'], 0, strripos($_SERVER['SCRIPT_FILENAME'], '/') + 1);
	$filename = realpath($path . '../Include/BotBanish_PreIncludes.php');
	require_once $filename;
	
	// No record keeping on installed IP
	
	$ip = BotBanishGetIP();	
	
	if (BotBanishCheckForGoodIP($ip)) // If we should not block IP, do nothing
		BotBanishExit(true);
		
	BotBanishSaveOverrideState();
	$user_agent = BotBanishGetUserAgent($_SERVER);
	
	$status = BotBanishCheckForBadSpider($user_agent);
	
	if ($status !== false)
		BotBanishExit(true);

	$row = array('bot_ip' => $ip, 'user_agent' => $user_agent);
	BotBanishHTACCESSUpdate($row, 'ip');	// Lock out IP too! (maybe overkill...)
	BotBanishInsertLocal($row);				// Update local IP Database
	
	$country_info = BotBanishGetCountryInfo($ip);
	
	if (isset($country_info['country']))
		
		$country = $country_info['country'];
	else
		$country = 'Unknown';

	// Notify the administrator

	$subject = sprintf($BotBanishText['BotBanishClient_mail_subject_bot'], 'Honey Pot - ' . $_SERVER['SERVER_NAME']);
	$body = sprintf($BotBanishText['BotBanishClient_mail_body_bot'], $ip, $user_agent);
	$body .= '<br>' . $BotBanishText['Server'] . ': ' . $_SERVER['SERVER_NAME'] . '<br>' . $BotBanishText['offending_country'] . ': ' . $country . '<br><br>';

	BotBanishSendMail($subject, $body);

	// Give the BOT the bum's rush!!!

	BotBanishRestoreOverrideState();
	
	BotBanishRedirectExit($BotBanishSettings['BOTBANISH_HIDDEN_LOCKOUT'], $ip);
?>