Location: PHPKode > projects > SCOP Heartbeat Administration interface > scop-2.0/html/scop/config/uploadmaint.php

<?
include ("../inc/header.inc");
include ("../inc/functions.inc");

# This page allows you to upload a new default maintenance page...
# The maintenance page is /var/www/html/index.html
$trans="18b";
$a18b = "${$l.$trans}";
$trans="4";
$a4 = "${$l.$trans}";

//echo "<center><h2>$a18b</h2>";
?>
<div id="contentArea">
<h1><a href="/scop/index.php?menu=maint&l=<?=$l?>"><?=$a4?></a> &gt; <?=$a18b?></h1>
<div class="border">			
<?

//echo "This form allows you to change the html for the maintenance page /var/www/html/index.html</br>";
//echo "This is the page that users will see if all of your real servers for a VIP are offline.</br>";
//echo "<i>NB. Obviously you can always change this using SCP if you prefer.</i>";




if ($action=="update") {
		SCOP_log("Config : New maintenance page uploaded");
		$mainthtml = $_POST['mainthtml'];
		$mainthtml = stripslashes($mainthtml);
		echo "</br>$mainthtml";
		# Open a file and write the contents of the field to it !
		exec ("sudo chmod 777 /var/www/html/index.html");
		if ($file=fopen("/var/www/html/index.html","w")) {

				fputs($file,$mainthtml);
				fclose($file);
				#Copy settings to slave
			flush();
			exec ("sudo scp /var/www/html/index.html hide@address.com:/var/www/html/index.html > /dev/null 2>&1 &");

		} else {

			draw_no_access ("/var/www/html/index.html");
		}
} else

{

	if ($file=fopen("/var/www/html/index.html","r")) {
		while (!feof ($file)) {
			$mainthtml = $mainthtml . fgets($file);
		}
			fclose($file);

	} else {

		draw_no_access ("/var/www/html/index.html");
	}

	echo "<FORM method=\"post\" action=\"?action=update&t=$t\">";
	echo "<table>";
	echo "<tr><td>";
	echo "<textarea  name=\"mainthtml\" cols=\"80\" rows=\"15\">$mainthtml</textarea></td></tr>";
	echo "</table>";
	echo "<INPUT type=\"submit\" value=\"$a18b\" name=\"go\" >";
	echo "</FORM></center>";

}
?>
</div>
<div class="bottom"><span>-----</span></div>
</div>
<?
//echo "<a href=\"/index.html\"></br>View the current maintenance page</a></br>";
//echo "</br><b>Securtity Tip :</b> <i>If you dont want any users to be able to access the local Apache web server when your Real Servers are down</br>";
//echo " then dont use localhost as your fallback server in the Virtual Server configuration.</i>";


include ("../inc/footer.inc");

?>


Return current item: SCOP Heartbeat Administration interface