function www_hits_search()
{
    $users = new usersMenus();
    SEND_CORP_LICENSE();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $boot = new boostrap_form();
    $search = string_to_flexquery("search-hits");
    $xtime = $_GET["xtime"];
    $hourtable = $tablemain = "youtubeday_" . date("Ymd", $_GET["xtime"]);
    $q = new mysql_squid_builder();
    $sql = "SELECT * FROM {$hourtable} WHERE youtubeid='{$_GET["youtubeid"]}' AND `{$_GET["filterBy"]}`='{$_GET["value"]}' ORDER BY `hour`";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderror($q->mysql_error);
    }
    $youtube = new YoutubeStats();
    $videotitle = $youtube->youtube_title($_GET["youtubeid"]);
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $youtubeid = $ligne["youtubeid"];
        $hits = FormatNumber($ligne["hits"]);
        $urljsSIT = "Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}')";
        $link = $boot->trswitch($urljsSIT);
        $urljsHour = "Loadjs('miniadm.webstats.ByHourYoutube.php?youtubeid={$youtubeid}&hour={$ligne["hour"]}&xtime={$_GET["xtime"]}')";
        $linkHour = $boot->trswitch($urljsHour);
        $tr[] = "\n\t\t<tr>\n\t\t<td {$linkHour}><i class='icon-globe'></i>&nbsp;{$ligne["hour"]}h</td>\n\t\t<td {$link}><i class='icon-globe'></i>&nbsp;{$videotitle}</td>\n\t\t<td nowrap><i class='icon-info-sign'></i>&nbsp;{$hits}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{hour}</th>\n\t\t\t<th>{video}</th>\n\t\t\t<th>{hits}</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>";
}
function members_search()
{
    $users = new usersMenus();
    SEND_CORP_LICENSE();
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $boot = new boostrap_form();
    $search = string_to_flexquery("search-members");
    $xtime = $_GET["xtime"];
    $hourtable = $tablemain = "youtubeday_" . date("Ymd", $_GET["xtime"]);
    $q = new mysql_squid_builder();
    $sql = "SELECT COUNT(youtubeid) as hits,uid,MAC,ipaddr,`hour` FROM {$hourtable} \n\tGROUP BY uid,MAC,ipaddr,`hour`\n\tHAVING `hour`='{$_GET["hour"]}' ORDER BY hits ASC";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderror($q->mysql_error);
    }
    $youtube = new YoutubeStats();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $youtubeid = $ligne["youtubeid"];
        $hits = FormatNumber($ligne["hits"]);
        $urljsSIT = "Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}')";
        $link = $boot->trswitch($urljsSIT);
        $tr[] = "\n\t\t<tr>\n\t\t<td {$link}><i class='icon-user'></i>&nbsp;{$ligne["uid"]}</td>\n\t\t<td {$link}><i class='icon-user'></i>&nbsp;{$ligne["MAC"]}</td>\n\t\t<td {$link}><i class='icon-user'></i>&nbsp;{$ligne["ipaddr"]}</td>\n\t\t<td nowrap><i class='icon-user'></i>&nbsp;{$hits}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{member}</th>\n\t\t\t<th>{MAC}</th>\n\t\t\t<th>{ipaddr}</th>\n\t\t\t<th>{videos}</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>";
}