예제 #1
0
파일: bydate.php 프로젝트: digideskio/sacc1
function show_bydays($link)
{
    $result = mysql_query("select UNIX_TIMESTAMP(DATE(FROM_UNIXTIME(min(utime)))) as _min, UNIX_TIMESTAMP(DATE(date_add(FROM_UNIXTIME(max(utime)), interval 1 day))) as _max from detail;", $link);
    $min = @mysql_result($result, 0, "_min");
    $max = @mysql_result($result, 0, "_max");
    $days = ceil(($max - $min) / (60 * 60 * 24));
    $cmin = $min;
    $mod_name = "day stat, daily level";
    show_head();
    show_help();
    echo "<!-- {$days} -->";
    echo "<HR NOSHADE COLOR=#000000 SIZE=1>\n<BR>\n";
    echo "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>\n      <TR><TD BGCOLOR=#93BEE2>\n      <TABLE BORDER=0 CELLPADDING=1 CELLSPACING=1>\n         <TR VALIGN=TOP ALIGN=CENTER>\n            <TD HEIGHT=15>day</TD>\n            <TD><B>count</B></TD>\n            <TD><B>bytes</B></TD>\n            </TR>";
    for ($i = 0; $i < $days; $i++) {
        $cmax = $cmin + 24 * 60 * 60 - 1;
        $result = mysql_query("SELECT sum(size) as _totalmb, count(size) as _total from detail where utime<{$cmax} and utime>{$cmin};", $link);
        $total = @mysql_result($result, 0, "_total");
        $totalmb = @mysql_result($result, 0, "_totalmb");
        if ($totalmb > 0) {
            echo "<TR BGCOLOR=#FFF7E5 ALIGN=RIGHT>\n\t<td ALIGN=LEFT>" . strftime("%B %d, %T", (int) $cmin) . "-" . strftime("%B %d, %T", (int) $cmax) . "</td>\n\t<td>{$total}</td>\n\t<td><a href=\"index.php?type=day2&t1={$cmin}&t2={$cmax}\">" . dotize($totalmb) . "</a></td>\n\t</tr>";
        }
        $cmin = $cmax + 1;
    }
    $result = mysql_query("SELECT sum(size) as _totalmb, count(size) as _total from detail;", $link);
    $total = @mysql_result($result, 0, "_total");
    $totalmb = @mysql_result($result, 0, "_totalmb");
    echo "<TR BGCOLOR=#FFF7E5 ALIGN=RIGHT>\n\t<td ALIGN=LEFT>total (" . strftime("%B %d, %T", (int) $min) . "-" . strftime("%B %d, %T", (int) $max) . ")</td>\n\t<td>{$total}</td>\n\t<td>" . dotize($totalmb) . "</td>\n\t</tr>";
    echo "</TABLE></TD></TR></TABLE><br>";
    show_tail();
    mysql_close($link);
    exit;
}
예제 #2
0
파일: mysql.php 프로젝트: digideskio/sacc1
function db_connect_ex($dbase)
{
    global $mysql_server, $mysql_login, $mysql_passwd, $try_again;
    $link = mysql_connect($mysql_server, $mysql_login, $mysql_passwd);
    $db = mysql_select_db($dbase, $link);
    if ($db == NULL) {
        show_head();
        echo "<H1>Warning!</H1>\n          <P>\n            <FONT COLOR=#FF0000>can't connect to MySQL or select database! Check rights on tables!</FONT>\n          </P>\n          <FORM>\n            <INPUT TYPE=button CLASS=\"inputsubmit\" VALUE=\"{$try_again}\" OnClick=\"window.location='index.php'\">\n          </FORM>\n";
        show_tail();
        @mysql_close($link);
    }
    mysql_query("set character_set_results= koi8r;", $link);
    mysql_query("set character_set_connection= koi8r;", $link);
    mysql_query("set character_set_client= koi8r;", $link);
    mysql_query("set character_set_database = koi8r;", $link);
    return $link;
}
예제 #3
0
파일: index.php 프로젝트: digideskio/sacc1
            list($month, $year) = get_month_year();
            //            echo "1. Введено: $PHP_AUTH_USER : $PHP_AUTH_PW <br>";
            //             echo "2. Введено: $ulogin : $passwd ";
            echo "<H1>{$web_client_your_stat} {$month} {$year}</H1>\n";
            $result = mysql_query("SELECT id FROM users where login='******'", $link);
            $id = mysql_result($result, 0, "id");
            show_info($link, $id);
            echo "<HR NOSHADE COLOR=#000000 SIZE=1>\n<BR>\n";
            show_stat($link, $id);
            echo "<HR NOSHADE COLOR=#000000 SIZE=1>\n";
            if (!isset($no_mail)) {
                show_mailstat($link, $PHP_AUTH_USER);
            }
            echo "<HR NOSHADE COLOR=#000000 SIZE=1>\n";
            //                show_form();
            show_tail();
            @mysql_close($link);
        }
    } else {
        Header("WWW-Authenticate: Basic realm=\"{$web_client_auth_realm}\"");
        Header("HTTP/1.0 401 Unauthorized");
        show_head();
        echo "1. Введено: {$PHP_AUTH_USER} : {$PHP_AUTH_PW} <br>";
        echo "{$msg} {$msg2}";
        show_help();
        echo "<P><FONT COLOR=#FF0000>{$web_client_auth_wrong}</FONT></P>";
        show_tail();
        @mysql_close($link);
        exit;
    }
}