Files
HotLunches/htswitch.php
T
2026-10-19 15:22:52 -07:00

52 lines
1.5 KiB
PHP

<?php
if (isset($_POST) && strlen($_POST['action'])) {
$action = $_POST['action'];
if ($action == 'Enable HTACCESS') {
if (file_exists(".htaccess.bak")) {
rename(".htaccess.bak",".htaccess");
$error_message = "File has been enabled";
}
else {
$error_message = ".htaccess.bak file not found";
}
}
if ($action == 'Disable HTACCESS') {
if (file_exists(".htaccess")) {
rename(".htaccess",".htaccess.bak");
$error_message = "File has been disabled";
}
else {
$error_message = ".htaccess file not found";
}
}
}
?>
<html>
<head>
<title>Toggle HTACCESS File</title>
</head>
<body>
<p><br></p>
<center>
<form method='post'>
<table width='500' cellpadding='10' style='border: 2px solid black'>
<tr>
<td align='center'>
<br>
<?php
if (isset($error_message) && strlen($error_message)) echo(" <p style='background: red; color: white; font-weight: bold'>$error_message</p>\n");
?>
<p style='font: 12px Arial, Helvetica, sans-serif;'>When enabled you will have access to the WordPress editor and any edits to the event calendar will not be visible. When disabled your edits to the CMS and event calendar will appear on the web site.</p>
<br>
<p><input type='submit' name='action' value='Enable HTACCESS'> <input type='submit' name='action' value='Disable HTACCESS'></p>
<br>
</td>
</tr>
</table>
</form>
</center>
</head>
</html>