Пример #1
0
See the License for the specific language governing permissions and
limitations under the License.
*/
require_once "utils.inc";
require_once "ui.inc";
require_once "pages.inc";
$gArchive = getParam('a');
$gLabel = getParam('l');
$gPageid = getParam('p');
$gFormat = getParam('format');
if ($gPageid && "csv" == $gFormat) {
    // request to download a CSV of an individual website's requests data
    header('Content-Type: application/octet-stream; name="httparchive.csv"');
    header('Content-Disposition: inline; filename="httparchive_page' . $gPageid . '.csv"');
    $aColumns = array("url", "mimeType", "method", "status", "time", "respSize", "reqCookieLen", "respCookieLen", "reqHttpVersion", "respHttpVersion", "req_accept", "req_accept_charset", "req_accept_encoding", "req_accept_language", "req_connection", "req_host", "req_referer", "resp_accept_ranges", "resp_age", "resp_cache_control", "resp_connection", "resp_content_encoding", "resp_content_language", "resp_content_length", "resp_content_location", "resp_content_type", "resp_date", "resp_etag", "resp_expires", "resp_keep_alive", "resp_last_modified", "resp_location", "resp_pragma", "resp_server", "resp_transfer_encoding", "resp_vary", "resp_via", "resp_x_powered_by");
    $sRows = implode(",", $aColumns);
    $sRows .= "\n";
    $row = doRowQuery("select wptid, wptrun from {$gPagesTable} where pageid = {$gPageid};");
    $page = pageFromWPT($row['wptid'], $row['wptrun']);
    $aResources = $page['resources'];
    foreach ($aResources as $resource) {
        foreach ($aColumns as $column) {
            $sRows .= (array_key_exists($column, $resource) ? '"' . $resource[$column] . '"' : "") . ",";
            // wrap in double quotes in case of commas
        }
        rtrim($sRows, ",");
        // remove trailing comma
        $sRows .= "\n";
    }
    echo $sRows;
}
Пример #2
0
<table id='stats' class='tablesort' border=0 cellpadding=0 cellspacing=0>
<?php 
// Print the table headers
echo "<tr>\n";
for ($i = 0; $i < $len; $i++) {
    $column = $columns[$i];
    $sTh = "<th" . (array_key_exists('sortable', $column) ? " class='sortnum'" : "") . (array_key_exists('hidden', $column) ? " style='display:none;'" : "") . ">" . $column['name'] . "</th>\n";
    echo $sTh;
}
echo "</tr>\n";
// MySQL Table
$sRows = "";
$iRow = 0;
$gFirstStart = 0;
$page = pageFromWPT($wptid, $wptrun);
$aResources = $page['resources'];
foreach ($aResources as $resource) {
    if (!$gFirstStart) {
        $gFirstStart = intval($resource['startedDateTime']);
    }
    $iRow++;
    $sRow = "<tr" . ($iRow % 2 == 0 ? " class=odd" : "") . ">";
    $sRow .= "<td class='tdnum '>{$iRow}</td> ";
    $sRow .= "<td class='nobr ' style='font-size: 0.9em;'><a href='" . $resource['url'] . "'>" . shortenUrl($resource['url']) . "</a></td> ";
    for ($i = 0; $i < $len; $i++) {
        $column = $columns[$i];
        if ('Req#' != $column['name'] && 'URL' != $column['name']) {
            $class = array_key_exists('class', $column) ? $column['class'] : "tdnum";
            $suffix = array_key_exists('suffix', $column) ? $column['suffix'] : "";
            $hidden = array_key_exists('hidden', $column) ? $column['hidden'] : "";