--- a/lib/common.inc.php +++ b/lib/common.inc.php @@ -1,27 +1,31 @@ setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +function databaseError($errMsg) +{ + die($errMsg); +} function ucsmart($str) { - return preg_replace("/(?<=(? 0) $supplierQ = "supplierABN = '" . $supplierParts[0] . "' AND "; - else $supplierQ = "supplierName LIKE '%" . $supplierParts[1] . "%' AND "; -} + $supplierName = "%".$supplierParts[1]."%"; + $supplierABN = $supplierParts[0]; + if ($supplierParts[0] > 0) $supplierQ = ' "supplierABN" = :supplierABN AND '; + else $supplierQ = ' "supplierName" LIKE :supplierName AND '; +} + $startYear = 2007; -$year = mysql_real_escape_string(stripslashes($_REQUEST['year'])); +$year = filter_var($_REQUEST['year'], FILTER_SANITIZE_NUMBER_INT); if ($year != "") $yearQ = "YEAR(publishDate) = " . $year . " AND "; -$standardQ = "childCN = 0 AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2010"; + +$standardQ = ' "childCN" = 0 '; // AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2010'; $start =0.0; function include_header($title) { @@ -58,7 +67,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> - Contract Dashboard - <?=$title?> + Contract Dashboard - <?php echo $title; ?>