<?php

///////////////////////////////////////////////////////////////////////////////////////////////////////
// BotBanish 9.0.02
// Randem Systems: https://randemsystems.support
// BotBanish Uninstall
// Date: 07/16/2026
//
// Function:
//		Uninstalling BotBanish For Websites
///////////////////////////////////////////////////////////////////////////////////////////////////////

	global $BotBanishText, $BotBanishSettings;

	$self = getcwd();

	$filename = realpath($self . '/../../Include/BotBanish_PreIncludes.php');

	$system = BotBanishCheckSystem();
	
	if (!file_exists($filename)) {

		echo 'BotBanish Not Installed';
		exit;
	}

	require_once $filename;

	if (!isset($_POST['yes_no'])) {

		include $BotBanishSettings['BOTBANISH_INCLUDE_DIR'] . 'BotBanish_DeleteData.php';

	} else {

		$delete = (isset($_POST['yes_no']) && ($_POST['yes_no'] == 'yes')) ? true : false;

		// Cleanup files

		$url = $BotBanishSettings['BOTBANISH_INSTALL_URL'] . 'Subs/BotBanishCleanUp/BotBanishInstallCleanUp.php?system=' . $system['system'] . '&silent=true&delete=' . $delete . '&internal=true';
		$response = BotBanishSendPostData($url, '',false, false, false);
		$complete = $response;
/*
		$records = BotBanishCleanUp($delete);
		$type = $BotBanishSettings['BOTBANISH_SERVER'] == 1? 'BotBanishServer_UninstallComplete' : 'BotBanishClient_UninstallComplete';
		$complete = '<br>' . $BotBanishSettings['BOTBANISH_USER_HOST'] . ':  ' . sprintf($BotBanishText[$type], $records['ip'], $records['bot'], $records['filecount'], $records['updated']);

		if ($records['filecount'] > 0)
			$complete .= '<br><br>' . BotBanishGrabArray($records['files']) . '<br><br>';
*/
		$BotBanishSettings['BOTBANISH_CLEANUP'] = true;
		include_once $BotBanishSettings['BOTBANISH_INCLUDE_DIR'] . 'BotBanish_ScreenComplete.php';
		CompleteScreen($complete, $BotBanishText[$BotBanishSettings['BOTBANISH_INSTALL_TYPE'] . '_Uninstall']);
	}
?>