1
0
Fork 0
chickadee/site_actions.php

27 lines
666 B
PHP

<?php
include_once "logcheck.php";
$simplecss = $_POST["simplecss"] ?? null;
if ( !is_null( $simplecss ) ) {
$file_data = file_get_contents( "config.php" );
if ( !$file_data ) {
header("Location: admin.php?success=0");
die();
}
$re = '/(const\s+SIMPLE_CSS\s+=\s+)(true|false)(\s*;)/m';
$subst = $simplecss == "1" ? "$1true$3" : "$1false$3";
$result = preg_replace($re, $subst, $file_data);
$success = file_put_contents( "config.php", $result );
if ( $success ) {
header("Location: admin.php?success=2");
die();
} else {
header("Location: admin.php?success=0");
die();
}
}
header("Location: admin.php");
die();