<?php
require_once('../../../config.php');
require_once(FOLDER_RELATIVE_COMMON . 'database.php');
//require_once(FOLDER_RELATIVE_COMMON . 'authorization.php');
require_once(FOLDER_RELATIVE_COMMON . 'refolder.php');
require_once(FOLDER_RELATIVE_COMMON . 'filesystem.php');
if ($_SERVER['HTTP_HOST'] != 'localhost') {
echo 'Revert script only accessible from localhost';
exit;
}
$contents = fileRead(FOLDER_RELATIVE_BASE . 'resource/install/DROP-TABLES.sql');
$multisql = explode(';', $contents);
$counter = 0;
foreach ($multisql as $sql) {
$sql = trim($sql);
// echo $sql . "<br>\n";
if (isset($sql) && $sql != '') {
try {
$connection = databaseGetConnection(true);
$connection->Execute($sql, null);
} catch (Exception $e) { }
}
}
$contents = fileRead(FOLDER_RELATIVE_BASE . 'resource/install/config.backup.php');
fileWrite(FOLDER_RELATIVE_BASE . 'config.php', $contents);
header('location:../install_welcome/install_welcome.php');
exit;
?>