/**
 * @param $course_code
 * @return array|bool
 */
function initializeReport($course_code)
{
    $course_info = api_get_course_info($course_code);
    $table_reporte_semanas = Database::get_main_table('rp_reporte_semanas');
    $table_students_report = Database::get_main_table('rp_students_report');
    $table_semanas_curso = Database::get_main_table('rp_semanas_curso');
    $table_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
    $table_post = Database::get_course_table(TABLE_FORUM_POST, $course_info['dbName']);
    $table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION, $course_info['dbName']);
    $course_code = Database::escape_string($course_code);
    $res = Database::query("SELECT COUNT(*) as cant FROM $table_reporte_semanas WHERE course_code = '" . $course_code . "'");
    $sqlWeeks = "SELECT semanas FROM $table_semanas_curso WHERE course_code = '$course_code'";
    $resWeeks = Database::query($sqlWeeks);
    $weeks = Database::fetch_object($resWeeks);
    $obj = Database::fetch_object($res);
    $weeksCount = (!isset($_POST['weeksNumber'])) ? (($weeks->semanas == 0) ? 7 : $weeks->semanas) : $_POST['weeksNumber'];
    $weeksCount = Database::escape_string($weeksCount);
    Database::query("REPLACE INTO $table_semanas_curso (course_code , semanas) VALUES ('$course_code','$weeksCount')");
    if (intval($obj->cant) != $weeksCount) {

        if (intval($obj->cant) > $weeksCount) {
            $sql = "DELETE FROM $table_reporte_semanas WHERE  week_id > $weeksCount AND course_code = '$course_code'";
            Database::query("DELETE FROM $table_reporte_semanas WHERE  week_id > $weeksCount AND course_code = '$course_code'");
        } else {
            for ($i = $obj->cant + 1; $i <= $weeksCount; $i++) {
                if (!Database::query("INSERT INTO $table_reporte_semanas (week_id, course_code, forum_id, work_id, quiz_id, pc_id)
						VALUES ($i, '$course_code', '0', '0', '0', '0' )")) {
                    return false;
                }
            }
        }
    }

    $sql = "REPLACE INTO $table_students_report (user_id, week_report_id, work_ok , thread_ok , quiz_ok , pc_ok)
			SELECT cu.user_id, rs.id, 0, 0, 0, 0
			FROM $table_course_rel_user cu
			LEFT JOIN $table_reporte_semanas rs ON cu.course_code = rs.course_code
			WHERE cu.status = 5 AND rs.course_code = '$course_code'
			ORDER BY cu.user_id, rs.id";
    if (!Database::query($sql)) {
        return false;
    } else {
        $page = (!isset($_GET['page'])) ? 1 : $_GET['page'];

        Database::query("UPDATE $table_students_report sr SET sr.work_ok = 1
		WHERE CONCAT (sr.user_id,',',sr.week_report_id)
		IN (SELECT DISTINCT CONCAT(w.user_id,',',rs.id)
		FROM $table_work w  JOIN $table_reporte_semanas rs ON w.parent_id = rs.work_id)");
        Database::query("UPDATE $table_students_report sr SET sr.thread_ok = 1
		WHERE CONCAT (sr.user_id,',',sr.week_report_id)
		IN (SELECT DISTINCT CONCAT(f.poster_id,',',rs.id)
		FROM $table_post f  JOIN $table_reporte_semanas rs ON f.thread_id = rs.forum_id)");

        return showResults($course_info, $weeksCount, $page);
    }
}
Example #2
0
function searchBooks()
{
    if ($_SERVER['REQUEST_METHOD'] != 'POST') {
        return;
    }
    $query = composeQuery();
    $connection = connect();
    $results = mysql_query($query, $connection);
    showResults($results);
    mysql_close($connection);
}
Example #3
0
function showMonthlySalesSummary()
{
    if ($_SERVER['REQUEST_METHOD'] != 'POST') {
        return;
    }
    $connection = connect();
    if (empty($_POST['month'])) {
        echo "<p class='center'>Please input a month.</p>";
        return;
    }
    if (empty($_POST['year'])) {
        echo "<p class='center'>Please input a year.</p>";
        return;
    }
    $query = composeQuery();
    $results = mysql_query($query, $connection);
    showResults($results);
    mysql_close($connection);
}
/**
 * @param $course_code
 * @return array|bool
 */
function initializeReport($course_code)
{
    $course_info = api_get_course_info($course_code);
    $table_reporte_semanas = Database::get_main_table('rp_reporte_semanas');
    $table_students_report = Database::get_main_table('rp_students_report');
    $table_semanas_curso = Database::get_main_table('rp_semanas_curso');
    $courseTable = Database::get_main_table(TABLE_MAIN_COURSE);
    $table_course_rel_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
    $table_post = Database::get_course_table(TABLE_FORUM_POST);
    $table_work = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
    $course_code = Database::escape_string($course_code);
    $res = Database::query("SELECT COUNT(*) as cant FROM {$table_reporte_semanas} WHERE course_code = '" . $course_code . "'");
    $sqlWeeks = "SELECT semanas FROM {$table_semanas_curso} WHERE course_code = '{$course_code}'";
    $resWeeks = Database::query($sqlWeeks);
    $weeks = Database::fetch_object($resWeeks);
    $obj = Database::fetch_object($res);
    $weeksCount = !isset($_POST['weeksNumber']) ? $weeks->semanas == 0 ? 7 : $weeks->semanas : $_POST['weeksNumber'];
    $weeksCount = Database::escape_string($weeksCount);
    Database::query("REPLACE INTO {$table_semanas_curso} (course_code , semanas) VALUES ('{$course_code}','{$weeksCount}')");
    if (intval($obj->cant) != $weeksCount) {
        if (intval($obj->cant) > $weeksCount) {
            $sql = "DELETE FROM {$table_reporte_semanas} WHERE  week_id > {$weeksCount} AND course_code = '{$course_code}'";
            Database::query("DELETE FROM {$table_reporte_semanas} WHERE  week_id > {$weeksCount} AND course_code = '{$course_code}'");
        } else {
            for ($i = $obj->cant + 1; $i <= $weeksCount; $i++) {
                if (!Database::query("INSERT INTO {$table_reporte_semanas} (week_id, course_code, forum_id, work_id, quiz_id, pc_id)\n\t\t\t\t\t\tVALUES ({$i}, '{$course_code}', '0', '0', '0', '0' )")) {
                    return false;
                }
            }
        }
    }
    $sql = "REPLACE INTO {$table_students_report} (user_id, week_report_id, work_ok , thread_ok , quiz_ok , pc_ok)\n\t\t\tSELECT cu.user_id, rs.id, 0, 0, 0, 0\n\t\t\tFROM {$table_course_rel_user} cu\n\t\t\tINNER JOIN {$courseTable} c\n\t\t\tON (c.id = cu.c_id)\n\t\t\tLEFT JOIN {$table_reporte_semanas} rs ON c.code = rs.course_code\n\t\t\tWHERE cu.status = 5 AND rs.course_code = '{$course_code}'\n\t\t\tORDER BY cu.user_id, rs.id";
    if (!Database::query($sql)) {
        return false;
    } else {
        $page = !isset($_GET['page']) ? 1 : $_GET['page'];
        Database::query("UPDATE {$table_students_report} sr SET sr.work_ok = 1\n\t\tWHERE CONCAT (sr.user_id,',',sr.week_report_id)\n\t\tIN (SELECT DISTINCT CONCAT(w.user_id,',',rs.id)\n\t\tFROM {$table_work} w  JOIN {$table_reporte_semanas} rs ON w.parent_id = rs.work_id)");
        Database::query("UPDATE {$table_students_report} sr SET sr.thread_ok = 1\n\t\tWHERE CONCAT (sr.user_id,',',sr.week_report_id)\n\t\tIN (SELECT DISTINCT CONCAT(f.poster_id,',',rs.id)\n\t\tFROM {$table_post} f  JOIN {$table_reporte_semanas} rs ON f.thread_id = rs.forum_id)");
        return showResults($course_info, $weeksCount, $page);
    }
}
function showContent()
{
    #----------------------------------------------------------------------
    #--- In debug mode, just calculate freshly and don't cache
    if (wcaDebug()) {
        showResults();
        return;
    }
    #--- If there's no cache or this is an update request, then freshly build the cache
    if (!file_exists('generated/statistics.cache') || getBooleanParam('update8392')) {
        $startTime = microtime_float();
        ob_start();
        showResults();
        file_put_contents('generated/statistics.cache', ob_get_contents());
        ob_end_clean();
        $logMessage = sprintf("%s: Updating took %.2f seconds.", wcaDate(), microtime_float() - $startTime);
        file_put_contents('generated/statistics.log', "{$logMessage}\n", FILE_APPEND);
        echo "<p>{$logMessage}</p>";
    }
    #--- Show the cache
    echo file_get_contents('generated/statistics.cache');
}
Example #6
0
function printfive($result)
{
    $query = "SELECT questionText, answer1Text, answer2Text, postID FROM Question ORDER BY postID DESC;";
    $result = mysql_query($query);
    $record = mysql_fetch_array($result);
    while ($record != false) {
        $questionText = $record['questionText'];
        $answer1Text = $record['answer1Text'];
        $answer2Text = $record['answer2Text'];
        $postID = $record['postID'];
        $normalQuestion = stripslashes($questionText);
        $normalA1 = stripslashes($answer1Text);
        $normalA2 = stripslashes($answer2Text);
        if (hasVoted($userID, $postID)) {
            showResults($postID, $normalQuestion, $normalA1, $normalA2);
        } else {
            echo "\t<td>{$normalQuestion}</td> ";
            echo <<<BLOCK2
\t\t\t\t<tr>
\t\t
\t\t\t\t\t<td>\t\t\t\t\t
\t\t\t\t\t\t\t<div onclick="location.href='vote.php?postID={$postID}&answerChoice=1'" class="ans1">
\t\t\t\t\t\t\t\t<input type="image" src="MidiateRedMan.png" name="redman" 
\t\t\t\t\t\t\t\twidth="60" height="60" /> {$normalA1} &nbsp &nbsp &nbsp
\t\t\t\t\t\t\t</div>

\t\t\t\t\t\t\t<div onclick="location.href='vote.php?postID={$postID}&answerChoice=2'" class="ans2"> 
\t\t\t\t\t\t\t
\t\t\t\t\t\t\t {$normalA2} <input type="image" src="MidiateBlueMan.png" name="blueman"
\t\t\t\t\t\t\t\twidth="60" height="60" />
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
BLOCK2;
        }
        $record = mysql_fetch_array($result);
    }
}
Example #7
0
?>
">
	<input type="hidden" name="userid" value="<?php 
echo htmlspecialchars($spotuser['userid']);
?>
">
<?php 
if ($dialogembedded) {
    ?>
	<input type="hidden" name="dialogembedded" value="1">
<?php 
}
?>

<?php 
showResults($result, array('renderhtml' => 1));
?>

	<div id="edituserpreferencetabs" class="ui-tabs">
		<ul>
			<li><a href="#edituserpreftab-1"><span><?php 
echo _('General');
?>
</span></a></li>
<?php 
if ($tplHelper->allowed(SpotSecurity::spotsec_download_integration, '')) {
    ?>
			<li><a href="#edituserpreftab-2"><span><?php 
    echo _('NZB handling');
    ?>
</span></a></li>
Example #8
0
<?php

include "includes/form-messages.inc.php";
showResults($result);
Example #9
0
<?php

use Defuse\Crypto\Crypto;
require_once 'autoload.php';
function showResults($type, $start, $end, $count)
{
    $time = $end - $start;
    $rate = $count / $time;
    echo $type, ': ', $rate, ' calls/s', "\n";
}
// Note: By default, the runtime tests are "cached" and not re-executed for
// every call. To disable this, look at the RuntimeTest() function.
$start = \microtime(true);
for ($i = 0; $i < 1000; $i++) {
    $key = Crypto::createNewRandomKey();
}
$end = \microtime(true);
showResults("createNewRandomKey()", $start, $end, 1000);
$start = \microtime(true);
for ($i = 0; $i < 100; $i++) {
    $ciphertext = Crypto::encrypt(\str_repeat("A", 1024 * 1024), \str_repeat("B", 16));
}
$end = microtime(true);
showResults("encrypt(1MB)", $start, $end, 100);
$start = microtime(true);
for ($i = 0; $i < 1000; $i++) {
    $ciphertext = Crypto::encrypt(\str_repeat("A", 1024), \str_repeat("B", 16));
}
$end = \microtime(true);
showResults("encrypt(1KB)", $start, $end, 1000);
    //define vars
    $apikey = "fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4";
    $limit = 10;
    $page = $_GET['page'];
    if ($page == 0 || !$_GET['page']) {
        $page = 1;
    }
    if ($page == 1) {
        $offset = 0;
    } else {
        $offset = ($page - 1) * $limit - 1;
    }
    $blog = $term . ".tumblr.com";
    //grab current page's posts
    $apidata = @file_get_contents("https://api.tumblr.com/v2/blog/{$blog}/posts?api_key={$apikey}&limit={$limit}&offset={$offset}");
    if ($apidata !== FALSE) {
        $apidata = json_decode($apidata);
        $total_post_count = $apidata->response->total_posts;
        //grab total count
        $mypostsdata = $apidata->response->posts;
        $mypostsdata = $apidata->response;
        return json_encode($mypostsdata, JSON_PRETTY_PRINT);
    } else {
        return "Not Found";
    }
}
//output
if ($_GET['q']) {
    echo showResults(str_replace(' ', '', $_GET['q']));
    //remove spaces before searching
}
Example #11
0
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Phonebook Web Application</title>
	<!-- instructor-provided CSS and Image links; do not modify -->
	<link href="css/page.css" type="text/css" rel="stylesheet">	
	<script type="text/javascript" src="validator.js"></script>	
</head>
<body>
<?php 
include "header.html";
include "common.php";
if (isset($_POST["search"])) {
    showResults($_POST["criteria"]);
} else {
    showResults("");
}
include "footer.html";
?>




</body>
</html>
Example #12
0
<?php

include "includes/form-messages.inc.php";
if (!showResults($result)) {
    ?>
<form class="edituserform" name="edituserform" action="<?php 
    echo $tplHelper->makeEditUserAction();
    ?>
" method="post">
	<input type="hidden" name="edituserform[xsrfid]" value="<?php 
    echo $tplHelper->generateXsrfCookie('edituserform');
    ?>
">
	<input type="hidden" name="userid" value="<?php 
    echo htmlspecialchars($edituserform['userid']);
    ?>
">
	<fieldset>
		<dl>
			<dt><label for="edituserform[username]"><?php 
    echo _('Username');
    ?>
</label></dt>
			<dd><input type="text" disabled="disabled" value="<?php 
    echo htmlspecialchars($edituserform['username']);
    ?>
"></dd>

<?php 
    if ($edituserform['userid'] > SPOTWEB_ANONYMOUS_USERID) {
        ?>
Example #13
0
<?php

include "includes/form-messages.inc.php";
/*
 * Do we need to redirect on success? If so, perform this
 */
if (isset($data['performredirect']) && $result->isSuccess()) {
    $tplHelper->redirect($loginform['http_referer']);
    return;
}
# if
$didSubmitForm = showResults($result, $data);
/*
 * If the form submission was successful, all output
 * we wanted has already been sent (either the JSON
 * or the redirect).
 *
 * If not, we try to re-render the form again
 */
if ($didSubmitForm && !isset($data['renderhtml'])) {
    return;
}
# if
/*
 * If no HTML headers are sent just yet, make sure
 * we send them to the client
 */
if (!isset($data['htmlheaderssent'])) {
    include_once "includes/basic-html-header.inc.php";
    $data['renderhtml'] = true;
}
Example #14
0
                    ?>
</p>
									<?php 
                }
                ?>
								<?php 
                $city = 0;
                if (isset($_GET['city'])) {
                    $city = $_GET['city'];
                }
                if (isset($_GET['page']) && !preg_match("#[^0-9]#", $_GET['page']) && $_GET['page'] != 0 && $_GET['page'] != '') {
                    $page = $_GET['page'];
                } else {
                    $page = 1;
                }
                showResults($_GET['location'], $city, '', 0, '', '', $currentCountry, $page, new mysqli($QL_Host, $QL_User, $QL_Password, $QL_DB));
                ?>
						</div>


							

						<div class="right-container">
								<?php 
                showSearchDiv(new mysqli($QL_Host, $QL_User, $QL_Password, $QL_DB), $currentCountry);
                ?>
						</div>
					</div>

						<?php 
            } else {
Example #15
0
<title>SELK - Search results for "<?php 
print $_POST['search'];
?>
"</title>
<link href="./css/layout.css" rel="stylesheet" type="text/css"/>
</head>

<body>
<?php 
mb_internal_encoding("UTF-8");
include "./includes/functions.inc";
$searchstr = $_POST["search"];
$words = returnWords($searchstr);
$sites = findAndSortSites($words);
if (is_array($sites)) {
    $results = showResults($sites);
    $index = 1;
    for ($i = 0; $i < sizeof($results); $i++) {
        $index;
        $url = $results[$i]['url'];
        $title = $results[$i]['title'];
        print "<p>{$index}. <a href=\"{$url}\">{$title}</a></p>";
        $index++;
    }
} else {
    print $sites;
}
?>
</body>
</html>
Example #16
0
<?php

/**
 * Tests the Issue model's core functionality
 * @package  Test
 * @author   Alan Hardman <*****@*****.**>
 */
require_once "base.php";
$test = new Test();
$issue = new Model\Issue();
$test->expect($issue->load(1) && $issue->id == 1, "Issue->load() by Integer");
$test->expect($issue->load(array('id = ?', 1)) && $issue->id == 1, "Issue->load() by String");
$test->expect(is_array($issue->getChildren()), "Issue->getChildren()");
$test->expect(is_array($issue->getAncestors()), "Issue->getAncestors()");
$test->expect($issue->save(false) && $issue->id, "Issue->save() without notifications");
// Output results
showResults($test);
Example #17
0
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* RSGallery is Free Software
*/
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
global $rsgOptions_path;
require_once $rsgOptions_path . 'search.html.php';
$cid = JRequest::getVar('cid', array(), 'default', 'array');
$task = rsgInstance::getVar('task', null);
//Load stylesheet from current template
global $rsgConfig;
$template_dir = JURI_SITE . "/components/com_rsgallery2/templates/" . $rsgConfig->get('template');
$doc =& JFactory::getDocument();
$doc->addStyleSheet($template_dir . "/css/template.css", "text/css");
switch ($task) {
    case 'showResults':
        showResults();
        break;
}
function showResults()
{
    $database = JFactory::getDBO();
    //Retrieve search string
    $searchtext = rsgInstance::getVar('searchtext', '');
    //Check searchtext against database
    $sql = "SELECT *, a.name as itemname, a.id as item_id FROM #__rsgallery2_files as a, #__rsgallery2_galleries as b " . "WHERE a.gallery_id = b.id " . "AND (" . "a.title LIKE '%{$searchtext}%' OR " . "a.descr LIKE '%{$searchtext}%'" . ") " . "AND a.published = 1 " . "AND b.published = 1 " . "GROUP BY a.id " . "ORDER BY a.id DESC";
    $database->setQuery($sql);
    $result = $database->loadObjectList();
    //show results
    html_rsg2_search::showResults($result, $searchtext);
}
function showExtendedSearch()
									$("your-circle").circliful({
										animationStep: 5,
										foregroundBorderWidth: 5,
										backgroundBorderWidth: 15,
										percent:' . $value['Percent'] . '});
							});
						</script>';
    if ($value['Percent'] <= 50) {
        echo "<tr>";
        echo "<td><img src ='images/CapstoneImages/{$value['Team One']}.png' style = 'opacity:0.4;'>";
        echo "{$value['Team One']}</td>";
        echo "<td>{$value['Percent']}%</td>";
        echo "<td><img src ='images/CapstoneImages/{$value['Team Two']}.png'>";
        echo "{$value['Team Two']}</td>";
        echo '</tr>';
        //echo $donut;
    } else {
        echo "<tr>";
        echo "<td><img src ='images/CapstoneImages/{$value['Team One']}.png'>";
        echo "{$value['Team One']}</td>";
        echo "<td>{$value['Percent']}%</td>";
        echo "<td><img src ='images/CapstoneImages/{$value['Team Two']}.png' style = 'opacity:0.4;'></td>";
        echo "<td>{$value['Team Two']}</td>";
        echo '</tr>';
    }
}
$gameData = csv_to_array('final_results_.csv');
$team_one = $_POST['Home'];
$team_two = $_POST['Away'];
showResults($gameData, $team_one, $team_two);
Example #19
0
<?php

include "includes/form-messages.inc.php";
if (showResults($result)) {
    return;
}
# if
?>

<div class="newspotdiv">
	<div></div> <!-- Empty div we can set loading to  -->
	<form class="newspotform" name="newspotform" id="newspotform" action="<?php 
echo $tplHelper->makePostSpotAction();
?>
" method="post"  enctype="multipart/form-data">
		<input type="hidden" name="newspotform[xsrfid]" value="<?php 
echo $tplHelper->generateXsrfCookie('newspotform');
?>
">
		<input type="hidden" name="newspotform[newmessageid]" value="">
		<input type="hidden" name="newspotform[submitpost]" value="Post">
		<input type="hidden" name="newspotform[randomstr]" value="<?php 
echo $tplHelper->getCleanRandomString(12);
?>
">
		<fieldset>

		<div>
			<div class="categorydropdown">
				<dt id='txtcategory'><?php 
echo _('Category');
Example #20
0
/**
 * Function to Process GET Requests
 * @global string $resRoot
 * @global string $resServer
 * @global string $resType
 * @global class array $db_tables
 * @global class array $db_conn
 * @global class $api
 * @param string $input_data
 */
function processGET($input_data)
{
    global $resRoot, $resServer, $resType, $db_tables, $db_conn, $api, $req_url;
    // Get Directory - Includes Token as first parameter
    $dir = explode("/", $input_data);
    // Clean up array
    $tmp = array();
    foreach ($dir as $item) {
        if (strlen($item) > 0) {
            $tmp[] = $item;
        }
    }
    $dir = $tmp;
    $tmp = NULL;
    // If API Key is true then the first element must be the API Key
    $api_key = 'public';
    $item_key = 0;
    // Used to keep track of the array items
    if ($api->getUseAPIKey()) {
        $api_key = $dir[$item_key];
        $valid = testAPIKey($api_key);
        if (!$valid) {
            exit(Error403($input_data));
        }
        $item_key++;
    }
    //  If only API Key then show list of Connections
    $conID = -9999;
    $resConn = new DB_Connection();
    if ($item_key + 1 > count($dir)) {
        // Return a List of Connections
        $resData = array();
        $resCount = 0;
        foreach ($db_conn as $conn) {
            $resData[] = array("type" => "resource", "value" => $conn->getName(), "description" => $conn->getDesc(), "link" => $resServer . "/" . $conn->getName(), "id" => $conn->getID());
            $resCount++;
        }
        showResults($resServer, $req_url, $resCount, $resData, $resType);
        exit;
    } else {
        // Check that the Connection is Valid
        $resData = array();
        $resCount = 0;
        foreach ($db_conn as $conn) {
            if (strtolower($dir[$item_key]) == strtolower($conn->getName())) {
                $conID = $conn->getID();
                $resConn = $conn;
                break;
            }
            // Get List just in-case needed
            $resData[] = array("type" => "resource", "value" => $conn->getName(), "description" => $conn->getDesc(), "link" => $resServer . "/" . $conn->getName(), "id" => $conn->getID());
            $resCount++;
        }
        // If Connection isn't found
        if ($conID === -9999) {
            showResults($resServer, $req_url, $resCount, $resData, $resType);
            exit;
        }
        // Increment Item Key
        $item_key++;
    }
    // Check if table is listed and valid
    $tblID = -9999;
    $resTable = new PublishTable();
    if ($item_key + 1 > count($dir)) {
        // Return a List of Tables
        $resData = array();
        $resCount = 0;
        foreach ($db_tables as $tbl) {
            if (strtolower($api_key) == 'public') {
                if ($tbl->getPublicAccess() > 0) {
                    if ($tbl->getConnID() == $conID) {
                        $resData[] = array("type" => "resource", "value" => $tbl->getName(), "description" => $tbl->getDesc(), "link" => $resServer . "/" . $tbl->getName(), "id" => $tbl->getTableID());
                        $resCount++;
                    }
                }
            } else {
                if ($tbl->getConnID() == $conID) {
                    $resData[] = array("type" => "resource", "value" => $tbl->getName(), "description" => $tbl->getDesc(), "link" => $resServer . "/" . $tbl->getName(), "id" => $tbl->getTableID());
                    $resCount++;
                }
            }
        }
        showResults($resServer, $req_url, $resCount, $resData, $resType);
        exit;
    } else {
        // Check Table Name is Valid for this Connection
        $resData = array();
        $resCount = 0;
        foreach ($db_tables as $tbl) {
            if (strtolower($api_key) == 'public') {
                if ($tbl->getPublicAccess() > 0) {
                    if ($tbl->getConnID() == $conID) {
                        // Test Table Name
                        if (strtolower($dir[$item_key]) == strtolower($tbl->getName())) {
                            $tblID = $tbl->getTableID();
                            $resTable = $tbl;
                            break;
                        }
                        $resData[] = array("type" => "resource", "value" => $tbl->getName(), "description" => $tbl->getDesc(), "link" => $resServer . "/" . $tbl->getName(), "id" => $tbl->getTableID());
                        $resCount++;
                    }
                }
            } else {
                if ($tbl->getConnID() == $conID) {
                    // Test Table Name
                    if (strtolower($dir[$item_key]) == strtolower($tbl->getName())) {
                        $tblID = $tbl->getTableID();
                        $resTable = $tbl;
                        break;
                    }
                    $resData[] = array("type" => "resource", "value" => $tbl->getName(), "description" => $tbl->getDesc(), "link" => $resServer . "/" . $tbl->getName(), "id" => $tbl->getTableID());
                    $resCount++;
                }
            }
        }
        // Exit if table not found
        if (strtolower($api_key) == 'public') {
            if ($tblID == -9999) {
                exit(Error404($req_url));
            }
        } else {
            if ($tblID == -9999) {
                showResults($resServer, $req_url, $resCount, $resData, $resType);
                exit;
            }
        }
        $item_key++;
    }
    // Check for Record Key
    $recID = -9999;
    if ($item_key + 1 > count($dir)) {
        // Return a List of Records
        $resData = array();
        $resCount = 0;
        // Query Table
        $resData = getRecord($resConn, $resTable, '', $resServer, $api_key);
        showResults($resServer, $req_url, count($resData), $resData, $resType);
        exit;
    } else {
        // Return a Single of Record
        $resData = array();
        $resCount = 0;
        // Query Table
        $resData = getRecord($resConn, $resTable, $dir[$item_key], $resServer, $api_key);
        showResults($resServer, $req_url, count($resData), $resData, $resType);
        exit;
        $item_key++;
    }
    return;
}