function dbq($sql,$f = ""){
//flags:
//a -> returns assoc array
//c -> just returns num of rows
$ary = array();
$dbconnect = new mysqli('localhost', 'ecoszzqh_webadm', '3xFu5naX-[3.', 'ecoszzqh_webadm');
$res = $dbconnect->query($sql);
if (!$res){
echo 'Error with following sql: $sql
';
return $ary;
}
while ($row = $res->fetch_assoc()) {
if ($f == "a"){
$ary[] = $row;
} else {
$ary[] = array_values($row);
}
}
if ($f == "c"){
return count($ary);
} else {
return $ary;
}
}
$dnum = date(Ymd)*4;
$from = $_GET['fr'];
if($from == ""){
$from = $_POST['fr'];
}
if($from != $dnum){
echo("<<<<Restricted Area>>>>" .
"
Sorry, you must Log In to view this Page
");
exit();
}
$usrn = $_GET['usrn'];
if($usrn == ""){
$usrn = $_POST['usrn'];
}
if($usrn == ""){
echo("<<<<Restricted Area>>>>" .
"
Problem with your username. Please Log In again.
");
exit();
}
$ID = $_GET['ID'];
//$dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1');
//mysql_select_db('ecosmar_website', $dbcnx);
$ok = dbq("SELECT ID,category,title,link,description,type FROM repdocs WHERE ID='$ID'");
$row = $ok[0];
$ID = $row[0];
$Category = $row[1];
$Title = $row[2];
$Link = $row[3];
$Description = $row[4];
$Type = $row[5];
?>