Exemple #1
0
function download($table, $display)
{
    if ($_REQUEST["download"] == "true") {
        $filename = "../../" . gmmktime() . ".csv";
        $file = fopen($filename, "w");
        foreach ($table as $row) {
            fwrite($file, UTF82Local("\"" . implode("\",\"", $row) . "\"\n"));
        }
        fclose($file);
        echo "<script>\n";
        echo "window.location.href='../../cgi-bin/gm_tools/download.php?file={$filename}&display={$display}';\n";
        echo "</script>\n";
    } else {
        global $tbl_sys_msg;
        echo "<table class='list_table'><tr><td><a href='" . get_http_args() . "&download=true' target='_blank'>[" . $tbl_sys_msg["download"] . "]</a></td></tr></table>";
    }
}
Exemple #2
0
function ShowVirWealthLog_ModulusChange($var, $gm)
{
    global $tbl_log_db, $tbl_sys_msg, $tbl_serv_db, $page_main, $tbl_modulus_type;
    if ($var["download"] == "true") {
        $tname = gmmktime();
        $filename = "../../" . $tname . ".csv";
        $file = fopen($filename, "w");
    } else {
        LastLogTime();
    }
    $server_id = $var["serverid"];
    $type = intval($var["type"]);
    $str = "";
    if ($var["begin_time"] != null && $var["begin_time"] != "") {
        $str .= " and lcesm_dtChangeTime >= '" . $var["begin_time"] . "'";
    }
    if ($var["end_time"] != null && $var["end_time"] != "") {
        $str .= " and lcesm_dtChangeTime <= '" . $var["end_time"] . "'";
    }
    if ($type != 0) {
        $str .= " and lcesm_uModulusType = " . $type;
    }
    $role_id = ArgRoleId();
    if (!$role_id) {
        return true;
    }
    if ($var["download"] == "true") {
        fwrite($file, "\"" . UTF82Local(implode("\",\"", array($tbl_sys_msg["time"], $page_main["type"], $page_main["number"])) . "\"\n"));
    } else {
        echo "<table class='list_table'>\n";
        printf("<tr><th style='width:120px;'>%s</th><th>%s</th><th>%s</th></tr>\n", $tbl_sys_msg["time"], $page_main["type"], $page_main["number"]);
    }
    $qs = "select lcesm_dtChangeTime, lcesm_uModulusType, lcesm_uModulusValue from tbl_log_char_exp_soul_modulus where lcs_uId = {$role_id}" . $str . " order by lcesm_dtChangeTime";
    $result = MySQLQuery($qs, "Log", $server_id);
    while ($row = mysql_fetch_row($result)) {
        if ($var["download"] == "true") {
            fwrite($file, UTF82Local("\"" . implode("\",\"", array($row[0], $tbl_modulus_type[$row[1]], $row[2])) . "\"\n"));
        } else {
            echo sprintf("<tr" . ($i++ % 2 == 0 ? "" : " class='even'") . "><td>%s</td><td>%s</td><td><pre>%s</pre></td></tr>\n", $row[0], $tbl_modulus_type[$row[1]], $row[2]);
        }
    }
    if ($var["download"] == "true") {
        global $page_action_name;
        fclose($file);
        echo "<script>\n";
        echo "window.location.href='../../cgi-bin/gm_tools/download.php?file={$tname}&display=" . $page_action_name[$var["action_name"]] . "';\n";
        echo "</script>\n";
    } else {
        echo "</table>\n";
        echo "<table class='list_table'><tr><td><a href='" . get_http_args() . "&download=true' target='_blank'>" . $tbl_sys_msg["download"] . "</a></td></tr></table>\n";
        ReturnAndBack();
    }
    return true;
}