<?php
if(file_exists('../../../'.$_REQUEST['tenant'].'/config.php')){require_once('../../../'.$_REQUEST['tenant'].'/config.php'); }
if(file_exists('/config.php')){require_once('/config.php');}

switch ($_REQUEST['FUNCTION']){
default:break;
case "insert":
$stmt = $GLOBALS['con']->prepare("INSERT INTO `dd_hse` VALUES(
NULL,
'".$_REQUEST['location']."',
'".$_REQUEST['address']."',
'".$_REQUEST['phone']."',
'".$_REQUEST['email']."',
'".$_REQUEST['fax']."',
'".$_REQUEST['contact']."',
'".$_REQUEST['notes']."'
)")or die(mysqli_error($GLOBALS['con']));
$stmt->execute();$stmt->close();
echo "s";

break;

case "update":
$stmt = $GLOBALS['con']->prepare("UPDATE `dd_hse` SET
`location`='".$_REQUEST['location']."',
`address`='".$_REQUEST['address']."',
`phone`='".$_REQUEST['phone']."',
`email`='".$_REQUEST['email']."',
`fax`='".$_REQUEST['fax']."',
`contact`='".$_REQUEST['contact']."',
`notes`='".$_REQUEST['notes']."'
WHERE `id`='".$_REQUEST['id']."'
")or die(mysqli_error($GLOBALS['con']));
$stmt->execute();$stmt->close();
echo "s";

break;

case "remove":
    $stmt = $GLOBALS['con']->prepare("DELETE FROM `dd_hse` WHERE `id`='".$_REQUEST['id']."'")or die(mysqli_error($GLOBALS['con']));
    $stmt->execute();$stmt->close();
    break;
}
?>