function deleteOldHistory() { $expireHistory = getSetup('expire_history'); $expireDate = date('Y-m-d', strtotime("-{$expireHistory} day")); foreach (glob('./history/*') as $f) { if (basename($f) < $expireDate) { unlink($f); } } }
function dbConnect() { $setup = 'prod'; if (getSetup() == 'prod') { $conn = mysql_connect('localhost', 'root', 'worldcup2014'); if (!$conn) { die(mysql_error()); } $db = mysql_select_db('bhemvineyard', $conn); if (!$db) { die(mysql_error()); } } elseif (getSetup() == 'server') { $conn = mysql_connect('bhemvineyard.db.11135963.hostedresource.com', 'bhemvineyard', 'Cayuga1!'); if (!$conn) { die(mysql_error()); } $db = mysql_select_db('bhemvineyard', $conn); if (!$db) { die(mysql_error()); } } }
if (!empty($rowFeatured["heading"])) { $featuredHeading = $rowFeatured["heading"]; } if (!empty($rowFeatured["introtext"])) { $featuredBlurb = $rowFeatured["introtext"]; } if (!empty($rowFeatured["content"])) { $featuredContent = $rowFeatured["content"]; } if (!empty($rowFeatured["image"])) { $featuredImage = "<img class='img-responsive' src='uploads/" . $rowFeatured["image"] . "' alt='" . $rowFeatured["image"] . "' title='" . $rowFeatured["image"] . "'>"; } $featuredImageAlign = $rowFeatured["image_align"]; } //Call - getSetup is used everywhere getSetup(); //Call these functions depending on which page you are visiting if ($_GET['ref'] > "") { getPage(); $theTitle = $setupTitle . " - " . $pageTitle; } else { if (basename($_SERVER['PHP_SELF']) == "about.php") { getAbout(); $theTitle = $setupTitle . " - " . $aboutTitle; } else { if (basename($_SERVER['PHP_SELF']) == "contact.php") { getContactInfo(); $theTitle = $setupTitle . " - " . $contactHeading; } else { if (basename($_SERVER['PHP_SELF']) == "services.php") { getServices();
function getSetup($key = null) { $arr = parse_ini_file('setup.ini'); return isset($key) ? $arr[$key] : $arr; } //$_POST['text'] = 'abc'; session_start(); if (!isset($_SESSION['name'])) { return; } $text = isset($_POST['text']) ? $_POST['text'] : ''; if ($text === '') { return; } $isApc = extension_loaded('apc'); $setup = getSetup(); $time = time(); $date = date('Y-m-d', $time); $uniqid = uniqid(); $id = $time . '-' . $uniqid; $tmpDir = './tmp/'; $historyDir = './history/'; $tmpFile = $tmpDir . 'cache'; $historyFile = $historyDir . $date; $fh = @fopen($historyFile, 'a'); if ($fh === false) { mkdir($historyDir); if (!is_dir($tmpDir)) { mkdir($tmpDir); } $fh = @fopen($historyFile, 'a');