Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/php/
Upload File :
Current File : /var/www/cesa.co.za/php/branchdocuments.php

<?php 
include_once("memberauth.php");

$arrCatNames["Minutes"] = "Agenda Minutes";
$arrCatNames["General"] = "General Correspondence";
$arrCatNames["YPF"] = "YPF Documents";

if (isset($_GET["cat"]) && !empty($_GET["cat"])) {

$pagetitle="CESA Branch ".$arrCatNames[$_GET["cat"]];

include_once("inc_db.php");

?>
<h2>CESA Branch <?php echo $arrCatNames[$_GET["cat"]]; ?></h2>
<?php
$cat = mysql_real_escape_string($_GET["cat"]."");
$id = intval($_GET["id"]);

$sql = "SELECT Document, DocName, SortOrder, REPLACE(Document, '".$cat."/".$id."/', '') AS DocSort FROM BranchDocuments WHERE BranchID='".$id."' AND Category='".$cat."' ORDER BY SortOrder, DocSort DESC";
$rec=mysql_query($sql);
if (mysql_num_rows($rec)>0) {
	while ($row = mysql_fetch_assoc($rec)) {
		$DocName = $row["DocName"];
		if (empty($DocName)) {
			$DocName = basename($row["Document"]);
			$DocName = substr($DocName, 0, strrpos($DocName, '.'));
			$DocName = ucwords(str_replace('_',' ',$DocName));
		}
		echo '<a href="/SAACEBranches/'.$row["Document"].'" target="_blank">'.$DocName.'</a><br><br>';
	}
} else {
	echo "No ".$arrCatNames[$_GET["cat"]]." found.";
}
mysql_free_result($rec);
}
?>