Location: PHPKode > projects > SCOP Heartbeat Administration interface > scop-2.0/html/scop/inc/header.inc
// SCOP.
//  Copyright (C) 2002 - 2004 >  Loadbalancer.org Limited

//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.

//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  GNU General Public License for more details.

//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.


$lbver = "v5.5"; // Lets have a constant version number  for fun.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  <meta http-equiv="content-type"
 content="text/html; charset=ISO-8859-1">
  <title>Administration System</title>
  <link rel="stylesheet" href="/scop/style.css"
 type="text/css" media="screen">

global $meta;
echo "$meta" ;
<!-- Original:  Jay Bienvenu -->
<!-- Web Site:  http://www.bienvenu.net -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	    return String(str).substring(0,n);
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);

function verifyIP (IPvalue) {
errorString = "";
theName = "IPaddress";

var ipPattern = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
var ipArray = IPvalue.match(ipPattern); 

if (IPvalue == "")
errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.';
else if (IPvalue == "")
errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.';
if (ipArray == null)
errorString = errorString + theName + ': '+IPvalue+' is not a valid IP address.';
else {
for (i = 0; i < 4; i++) {
thisSegment = ipArray[i];
if (thisSegment > 255) {
errorString = errorString + theName + ': '+IPvalue+' is not a valid IP address.';
i = 4;
if ((i == 0) && (thisSegment > 255)) {
errorString = errorString + theName + ': '+IPvalue+' is a special IP address and cannot be used here.';
i = 4;
extensionLength = 3;
if (IPvalue == "")
return true
if (errorString == "")
return true
// alert ("That is a valid IP address.");
alert (errorString);
return false
//  End -->

<script language="javascript" type="text/javascript">
var message;
function areyousure(message)
{ // Generic function to confirm a request
	if (confirm(message))
		return true
		return false




<div id="container">
 <div id="header">
 <h2><font color="brown">SCOP HEART</font>BEAT Administration Interface</h2>
 <div class="info" align="right">
  <a href="?l=e"><img src="/scop/images/e.gif" alt="English" width="29" height="20" border="0"></a><a href="?l=p"><img src="/scop/images/p.gif" alt="Portugues" width="29" height="20" border="0"></a><a href="?l=d"><img src="/scop/images/d.gif" alt="Deutsch" border="0" width="29" height="20"></a><a href="?l=f"><img src="/scop/images/f.gif" alt="Francais" width="29" height="20" border="0"></a><a href="?l=s"><img src="/scop/images/s.gif" alt="Espanyol" width="29" height="20" border="0"></a>

// Change log for v0.1-> 0.5 tuncated.
// Changed method for vars as register_globals no longer set in PHP 4.2
// In Modify Virtual Server Checktype 'None' changed to 'On'
// Persistence now remembers when it is set to NO
// Added further checktypes for imap,smtp,pop,nntp
// Added option to set the granularity to handle AOL Mega Proxy
// Fixed the modify host lookup to sugest correct values
// Changed execute shell command so that it displays the output
// Added new global settings section for modifying timeouts
// Small bug fixes to the password section
// Changed host/gateway hostname is now a drop down
// Small stats 'touch ups' added MAX connections
// 01.03.03 Released - Loadbalancer.org web based administration v0.6
// Add labels for VIPs and RIPs (NB. Requires lb.org modified ldirectord or version < 1.65 !)
// Modify reports and maintenance page to show labels
// Tidy more code into functions
// Add more auto-configuration for port nos when creating vips
// Add more config error checking
// Change authentication process (remove need to re-log in) first page requires auth.
// If granularity is blank change it to single source ip i.e.
// Added checks for rip port matching vip port and vip port matching fallback port
// Changed warnings and errors to be red i.e <h3>
// Changed graphical stats to use the rip & vip labels
// Changed add_vip so that it modifies haresources + small fix to changvips.php
// Change vip checks to allow the use of firewall marks
// Added protocol 'fwm'
// Added modify firewall script feature NB. rc.local must call rc.firewall
// Added DR option to download rc.firewall script
// Added quiescent option to 'global settings'.
// Small fixes to both firewall & maintenace page
// Fixed /usr/local/bin/lvsgp.daily to work with firewall marks
// 08.05.03 Released - Loadbalancer.org web based administration v0.7
// If Quiescent is blank set it to 'yes'
// If hostname is updated then change hostname.inc as well
// Started constructing the configuration FAQ
// Added context sensitive question marks linking to the FAQ
// Modified change hostname so that it auto updates the SSH keys for replication
// Changed lots of scripts to auto SCP changes to slave
// Changed the modify ip script to allow changes to both eth0 and eth1
// Updated backup and restore scripts to cope with rc.firewall
// 02.06.03 Released - Loadbalancer.org web based administration v0.8
// : Need to double check the changes from 0.81 I think its just resolv.conf + rc.firewall
// 26.07.03 In hospital with cancer... geez.. still lots of time on my hands :-).
// Ideas for 0.9 beta, drop down port list options, easy status at a glance, lots of Wizards, More help
// Implemented current as well as requested status on the maintenance page, needs some look and feel work
// Email notifications need to be added to ldirectord, + logging system for admin commands ?
// Implemented the SCOP logging system.
// Fixed small bug in eth1 setup
// : Ability to change clock on the server would be nice
// : The tables need to stop jumping around and line up most of the time.
// Fixing bugs in password.php + tidying up , now sorted but needs java script ?
// Fixed missing chmod 777 from scop-log update
// : need option to be able to change local passwords and SSH keys
// : Internet based update would be kewel.. (but dangerous!)
// Still need to fix creating ifcfg-eth1 if it doesnt exist
// Added draw_error function
// Tidyd up most config scripts to use draw_error and <p>
// When you edit a user it needs to remember the group automaticaly this is now fixed 24.08.03
// : maintenace page should remember the origional weight of a server and need global slow start option.
// Implemented lots of javascript areyousure? messages on anything dangerous
// : The physical ip address page needs javascript or PHP  to auto fill in the broadcast address etc
// : ldirectord really needs to allow port mapping, rather than using fwmarks.(although only big customers will do  it.)
// : NB. This can only be done in NAT mode.
// Removed the drop down port lists I don't think I want them added a port list to the help..
// Javascript checking all seems OK now.
// I need to decide about how to release v0.9 and what should be in it ASAP.
// Made some small changes to the layout of edit configuration and reports.
// 27.08.03 Released - Loadbalancer.org web based administration v0.9
// 04.03.04 Just recovering from my bone marrow transplant induced comma..
// Flexiserv have asked me to implement a tracking system for the American market, I don't see the point but...
// When you enter a default gateway and if the $SPY variable is true the ip details are sent to www.SCOP.org
// 09.05.04 Added various Java Script checks to the edit network or ip config sections
// 01.06.04 Add eth2 interface to setup for gigabit networks ENTERPRISE version
// Remove eth1 from BASIK version
// 19.06.04 Add global switch for ENTERPRISE / BASIK versions.
// Add ENTERPRISE option to select default gateway interface in network config
// 21.06.04 Fixed default gateway change bug old gateway now deleted
// Changed DR, Userbackup & Userrestore for ENTERPRISE version
// Debuged JavaScript checking a bit but needs more work
// Added view route table option
// :remember to take at log file rotation for SCOP etc.
// :need to fix the rc.firewall script upload problem
// Firewall script upload is now fixed just needed \r 's striped out
// Config changes : New Default Firewall Script, Quiescent=NO as default.
// 25.06.04 Released - Loadbalancer.org web based administration v0.9.1
// 09.07.04 Fixed last minute bug, when adding virtual server and also adding physical VIP
// it wasn't replicating to slave !
// 09.07.04 Re-Released - Loadbalancer.org web based administration v0.9.1
// 21.08.04 Started work on V3.1 Beta
// Many changes to the style sheet to improve the look and feel
// 23.08.04 Maintenance page revamped and re-styled now includeds active connections
// 28.08.04 DR Options now include upload functionality for config file.
// Restore of manufacturers settings now restores passwords and groups
// 01.09.04 Automatic software update included, commands are downloaded from www.SCOP.org
// :Some work on checking how name resoloution is initialised is required
// : Also needs legacy.php tested on various versions to ensure smooth upgrade to v3.1
// : v3.1+ will become the legacy platform with easy changes backported
// : v4.1+ will be the new Centros platform
// 12.09.04 Menu structure revamped to be more logical, security kept in place.
// 22.09.04 Released -SCOP v3.1
// 22.09.04 Released -SCOP v3.1.1 (Just an online update to prove it works.) 
// : Centros seems to be a bit picky about hardware especially EPIA boards
// : Decided to go with Slackware which now has fantastic HW detection
// : SO v4.1 is based on Slackware 10 (2.4.26 Kernel) with Slackware Latest SSH,OpenSSL & Apache
// : v4.1 is deisgned to be <500mb so that the iso can be created from a 1GB card with ease.
// : Software modify'd to work with bsd style init scripts so no longer backwards compatible.
// : Latest HA-LINUX 1.2.3, IPVS etc & ldirectord 1.9
// : KDE DROPPED completey linxs or links can be used from the console
// : ntpdate run once a day, ldirectord restart once a day still small NET::SSLEAY leak
// : Concept of ENETERPRISE & BASIK to be dropped ? 2 NICs only supported ?
// : New hardware can be fully solid state if required
// : All changes will now be available through online update.
// : One year aniversary since my transplant so its about time to push this product hard.
// 12.11.04 Released -SCOP v4.1
// 21.11.04 Released - v4.1.1 - Patch to upgrade Apache,SSL,PHP,GLIBC & SSHD to latest versions
// 15.01.05 Added ability to use virtualhost,checkport,login & passwd in the virtual server config.
// 30.01.05 Released - v4.1.2
// 20.03.05 Backport recent patches to old clients using auto-update to upgrade
// Upgrade to ldirectord v1.99 which finaly fully solves the HTTPS negotiate memory leak.
// Fix the .htaccess files that were corrupted previously
// Small fix to restore script permissions config,maint,stats etc.
// Fixed pause when updating user passwords
// Fix to changeip to prevent blank ip address being posted
// Fixed remove virtual server function to also delete everything else related as it should
// NB: Auto-Update will NOT Inline patches to rc.firewall, ha.cf or Perl Libraries (that have been fixed in the current ISO)
// 24.03.05 Released - v4.1.3
// 01.04.05 Production ISO updated to v4.1.3 patches syncd with v10 slackware tree
// 12.05.05 Modified reports to allow display of UDP connections
// Fixed several UDP related GUI bugs
// Added the schedulers for Source Hashing and Destination Hashing
// Turned off the Flexiserv SPY functionality.
// Fixed https admin cert
// 13.05.05 Released - v4.1.4
// Updated maintenance and reports to auto refresh every 10 seconds
// Allow 4 NICs for SLEDGE & 2 NICs for ENT (added broadcom gigabit drivers)
// Changed the changeip.php validation to do full checks...
// Split network and ip config again..
// 17.06.05 Released - v4.1.5
// Security updates for ZLIB, PCRE, PHP, SUDO, Mod_SSL & vconfig
// 01.09.05 Released - v4.1.6
// Security updates for Apache & Mod_SSL
// 15.11.05 Released - v4.1.7
// Language support increased & timeconfig added, default keyboard changed to US.
// Added force slave sync feature + removed slave from hosts if not required
// Removed the 'auto add VIP' to hareasources made it default action
// Stoped user adding duplicate VIPs or RIPs, force fallback server to use same port in DR mode
// Multiple IP validation checks added to all forms.
// 29.11.06 Released - v4.2.0
// Upgrade ldirectord to v1.132
// Add mysql,sip & ping checks
// Add negotiatetimeout global setting
// 04.04.06 Released - v4.2.1
// SIP/TCP/UDP GUI bug + typos in language file.
// 13.04.06 Released - v4.2.2
// Fixed 3 bugs relating to adding & modifying physical VIPs from the logical VIP interface + the full sync wasn't working
// 02.05.06 Released - v4.2.3
// Security updates for Apache & mod_ssl
// 10.05.06 Released - v4.2.4
// Sync file fixed so that it doesn't pause system wrapper any more when slave not present
// Ldirectord modified to re-add the reliable check_https
// Functions.inc,changevips.php,restart.php & reports.php modified so that new vips brought online without downtime
// 10.07.06 Released - v4.2.5
// Display.php strip spaces from request and receive + allow /
// Added Telnet negotiate check and re-patched ldirectord for other lb changes
// 13.07.06 Released - v4.2.6
// Stop allowing persitence timeout to be set to 0
// Merged Horms patch for FTP Negotiate
// Added Feedback agent (html and telnet/sock)
// 22.07.06 Released - v4.2.7
// Upgraded Kernel to 2.4.32 + ops patch
// Patched ipvsadm + ldirectord for ops patch
// 01.08.06 Released - v5.1
// Disable write in demo, tidy errors, disble most logging in syslog.conf
// New ldirectord patched by Adam allows TCP health check for UDP services.
// Seurity updates for Gzip, OpenSSL & OpenSSL-Solibs
// 25.09.06 Released - v5.2
// Make licence key part of core distro
// Integrate Pound-SLL and Ha-Proxy (Layer 7)
// Add commands lbrestore, lbhiports & lbloports
// 12.12.06 Released - v5.3
// Fixed javascript warning for graphs + LOGS header missing
// Fixed bug with fallback server forwarding method
// Add command rc.flush-iptables and modified rc.firewall
// 05.02.07 Released - v5.4
// New firewall lock down wizard
// HAProxy & Pound now report errors on start
// New SSL certificate management
// 16.02.07 Released - v5.5

// Set up the vars aka.PHP4.2
$l = $_GET['l'];
if ($l!='d' && $l!='f' && $l!='s' && $l!='p'){
$menu = $_GET['menu'];
$action = $_GET['action'];
$srcfile = $_GET['srcfile'];
$service = $_GET['service'];
$subaction = $_GET['subaction'];
$v = $_GET['v'];
$r = $_GET['r'];
$demo = "FALSE"; // Remember to demo proof everything in the code

$updateurl = "www.SCOP.org"; // Where do we go for online updates ?
$spy = "off"; // Tracks your ip address against www.SCOP.org database

// SCOP_log($message) ; // Write to the SCOP log
// helpitem($helpid); // Quick helpid function

function helpitem($helpid) {
	global $l;
	echo "&nbsp;&nbsp;<a href=\"/scop/help_$l.php#$helpid\" class=\"help\" target=\"new\"><img src=\"/scop/images/help.gif\" border=\"0\" alt=\"help\"></a>" ;


# Set up the timestamp
$t=$t . "&l=" . $l;

$view = "${$l.$trans}";
$edit = "${$l.$trans}";
$maint = "${$l.$trans}";
$reports = "${$l.$trans}";
$logs = "${$l.$trans}";

<div id="navigation">
  <li><a href="/scop/index.php?menu=maint&t=<?=$t?>"><?=$maint?></a></li>
  <li class="end"><a


function SCOP_log($message) {
// Write a message to the log file

exec ("sudo chmod 777 /var/log/scop-log");
if ($file=fopen("/var/log/scop-log","a")) {

			#$dateandtime = JDToJulian(time());
			$dateandtime = date("l F j H:i:s Y",time());
			fputs($file,"[$dateandtime] $message \n");
		else { echo  "<h3>Error : Can't open the scop-log file for write access ?</h3>";
			echo  "<h3>Warning : Creating new scop-log file.</h3>";
			exec ("sudo chmod 777 /var/log");
			exec ("sudo touch /var/log/scop-log");
			exec ("sudo chmod 777 /var/log/scop-log");



<!--End of header.inc-->
Return current item: SCOP Heartbeat Administration interface