<?php
###########################################################################################
#Copyright Notice
#
# I Paul Hardwick (hide@address.com) own the copyright for this program and its contents - � 2009-2012 www.saphe.net.
# All rights reserved.
#
# You may not, except with my express written permission, distribute or commercially exploit the content.
# Nor may you transmit it or store it in any other website or other form of electronic retrieval system.
#
# This program is a component of the Saphe.net Simple Site Intergrity Monitor application which is
# �2012 PECK Consulting and subject to the end user software license agreement (EULA.pdf)
#included with this software.
#
###########################################################################################
###########################################################################################
session_start();
unset($auditroot);
@include_once 'includes'.DIRECTORY_SEPARATOR.'sa_config.php';
require_once 'includes'.DIRECTORY_SEPARATOR.'sa_tools.php';
function sanitise($in) {
$out = trim($in);
return $out;
}
function makehash($in) {
global $saphemagic;
$out = sha1($in . $saphemagic );
return $out;
}
function doSetup(){
unset($_SESSION['pfuid']);
$_SESSION['vsfuid'] = saveLoginKey('valid');
redirect('setup/setup.php');
}
function doAudit(){
unset($_SESSION['pfuid']);
$_SESSION['vafuid'] = saveLoginKey('valid');
redirect('fraudit.php');
}
function doBuild(){
unset($_SESSION['pfuid']);
$_SESSION['vbfuid'] = saveLoginKey('valid');
redirect('frbuild.php');
}
function doDownload(){
redirect('ssim.php');
}
if( isset($_SESSION['pfuid']) && array_key_exists('now', $_POST) && (loadLoginKey('pre') == $_SESSION['pfuid'])){// && timeOK($_POST['now']) ) {
saveLoginKey('pre',false);
if(cntTries() >= 10) die ("To late".cntTries());
if(($_POST['task'] == 'Build') && ( passOK(makehash($_POST['pass']),'b') )){
resetTries();
doBuild();
}
elseif (($_POST['task'] == 'Audit') &&( passOK(makehash($_POST['pass']),'a'))) {
resetTries();
doAudit();
}
elseif (($_POST['task'] == 'Setup') &&( passOK(makehash($_POST['pass']),'b'))) {
resetTries();
doSetup();
}
elseif (($_POST['task'] == 'Download') &&( passOK(makehash($_POST['pass']),'b'))) {
resetTries();
doDownload();
} else {
echo "failed<br>";
updateTries(true);
unset($_SESSION['pfuid']);
}
}
else{
$webhead = makehead("Saphe.net Simple Site Integrity Monitor.");
$_SESSION['pfuid'] = saveLoginKey('pre');
saveLoginKey('valid',false);
$pagetmpl = file_get_contents($ssimtemplate);
$page = str_replace(array('<<|head|>>','<<|SELF|>>','<<|now|>>','<<|fuid|>>','<<|news|>>','<<|foot|>>'),
array($webhead,$_SERVER['PHP_SELF'], time(), $_SESSION['pfuid'],getRemoteData(),$foot),$pagetmpl);
echo $page;
}
?>