<?php
include 'inc/config.php';
include 'inc/connect.php';
date_default_timezone_set('Europe/Dublin');
session_start();

if (!isset($_SESSION['loggedin'])) {
	die();
}

if($handlers_access != "checked"){
    if ($_SESSION['role'] != "Admin") {
      die();
    }
}


$str = file_get_contents('inc/config.php');


$cfgfrom = $_POST['cfgfrom'];
$cfgurl = $_POST['cfgurl'];
$cfgamount = $_POST['cfgamount'];



$str = str_replace("cfg_from = '$cfg_from'", "cfg_from = '$cfgfrom'", $str);
$str = str_replace("cfg_url = '$cfg_url'", "cfg_url = '$cfgurl'", $str);
$str = str_replace("cfg_amount = '$cfg_amount'", "cfg_amount = '$cfgamount'", $str);




file_put_contents('inc/config.php', $str);

$oldFolderName = '../' . $cfg_url;
$newFolderName = '../' . $cfgurl;
rename($oldFolderName, $newFolderName);

$_SESSION['update_settings'] = 'success';
header('Location: interac.php');
exit;
?>