}
        ?>
">&nbsp;<b class="g">day<small>(s)</small></b> Reset Traffic</div>
</div>
</td>
<td class="tdacc" id="limittraf2" style="display:<?php 
        echo $limitbytrafficchk ? 'none' : '';
        ?>
">
<div id="curtrafic" align="center" style="position:absolute;float:left;width:200px;padding-left:270px; margin-top:-10px; display:<?php 
        echo $limitbytraffic ? "" : "none;";
        ?>
"><div id="trafwaiting" align="left" style="display:none;"></div></div>
<div style="padding-left:20px; margin-top: 0px;">
<span>Quota Traffic allowed. Currently traffic:&nbsp;<span id="cur_traffic"><b class="g" style="position:absolute;"><span id="trafshowresults" style="position:float:center;display:;"><?php 
        $cur_trf = get_traffic(TRAFFIC_LST);
        echo bytesToKbOrMbOrGb($cur_trf[0]);
        ?>
</span>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="<?php 
        echo $ajax_serverfiles ? 'if(confirm(\'This will reset Current Traffic, proceed?\')){trafst();}' : 'alert(\'Ajax Disabled\');';
        ?>
;"><small>reset</small></a></b></span></span> 
<div style="height:3px;">&nbsp;</div>
<div style="float:left;">The D-Day traffic quota will expired</div><br><div style="height:3px;">&nbsp;</div>
<div style="float:left;">Auto-Reset traffic. set to 0 or blank to disable.
<?php 
        if ($day_reset_trafic > 0) {
            echo "<small class='g'>remain: " . sec2time(timeremain_traffic($day_reset_trafic, $cur_trf[1])) . "</small>";
        }
        ?>
</div>
<?php

include_once 'bztraffic.php';
$id = $_GET['id'];
if (isset($id)) {
    echo get_traffic($id);
}
Example #3
0
function write_config_file($config_file, $s)
{
    global $_debug, $close_config_page, $saved_success, $showpostn, $iserr, $day_reset_trafic;
    $ret_TEXT = '';
    $showpostn = true;
    //cek limit by ip
    if (isset($_POST['limitbyip']) && $_POST['limitbyip'] == 'on') {
        if (empty($_POST['max_free_dl'])) {
            $showpostn = true;
            $iserr = '<b class="a">Leeching per ip is empty..</b><b class="b">!</b><br>';
            return false;
        } elseif (empty($_POST['delayip'])) {
            $showpostn = true;
            $iserr = '<b class="a">Delay per ip is empty..</b><b class="b">!</b><br>';
            return false;
        }
    }
    if (isset($_POST["limitbytraffic"]) && $_POST["limitbytraffic"] == "on") {
        if (!preg_match('/^\\d{1,2}\\/\\d{1,2}\\/\\d{4}$/', $_POST['YetAnotherDate']) || empty($_POST['max_trafic'])) {
            $iserr = '<b class="a">Expire-Date Traffic is not a Date..</b><b class="b">!</b><br>';
            return false;
        }
    }
    if (isset($_POST["limit_timework"]) && $_POST["limit_timework"] == "on") {
        $regtime = '/^([0-9]{1,2}):([0-5][0-9]):([0-5][0-9])$/';
        if (!preg_match($regtime, $_POST['workstart']) || !preg_match($regtime, $_POST['workend'])) {
            $iserr = '<b class="a">Limit by Time is not a Time format..</b><b class="b">!</b><br>';
            return false;
        }
    }
    isblankfield(isset($_POST['limited_edition']) ? $_POST['limited_edition'] : "", $_POST['list_allow_ip']);
    if (empty($_POST['dir'])) {
        $showpostn = true;
        $iserr = '<b class="a">Download directory is empty..</b><b class="b">!</b><br>';
        return false;
    }
    if (empty($_POST['newusercp']) || empty($_POST['newpascp'])) {
        $showpostn = true;
        $iserr = '<b class="a">Username or Password login Cpanel is empty..</b><b class="b">!</b><br>';
        return false;
    }
    if (isset($_POST['login']) && $_POST['login'] == 'on' && (empty($_POST['user']) || empty($_POST['pass']))) {
        $showpostn = true;
        $iserr = '<b class="a">Username or Password login index page is empty..</b><b class="b">!</b><br>';
        return false;
    }
    if ($_debug) {
        $ret_TEXT .= "Debug Mode: <b class=a>ON</b><br>";
        $ret_TEXT .= "<textarea name=\"edit_text\" cols=\"122\" rows=\"20\" width=\"100%\" readonly>" . $s . "</textarea>";
    }
    $close_config_page = true;
    $saved_success = false;
    if (!$iserr) {
        $fp = @fopen($config_file, "w");
        $lip = $_POST["mip_list"];
        $fp2 = @fopen(LOG_DIR . "mip_iplist.txt", "w");
        if (!$fp) {
            $showpostn = true;
            $ret_TEXT .= "<b class=\"a\">Can't write to file..</b><b class=\"b\">!</b><br>";
            fclose($fp);
            return false;
        } else {
            @fwrite($fp, $s);
            fclose($fp);
            // saving mip list
            if ($fp2) {
                fwrite($fp2, $lip);
                fclose($fp2);
            }
            // saving traffic if changed
            if ($day_reset_trafic != $_POST['day_reset_trafic']) {
                $cur_trf = get_traffic(TRAFFIC_LST);
                upd_traffictime($cur_trf[0]);
            }
            $ret_TEXT .= '<p><b style="color:#00FF33">Saved!</b>';
            $saved_success = true;
        }
    } else {
        $ret_TEXT .= "<br>{$iserr}<br><b class=\"a\">An errors occur, configuration is not saved</b><br>";
    }
    $ret_TEXT .= '<div style="height:10px;"></div><input id="btn_back" type="button" onClick="location.href=\'./' . basename($_SERVER['PHP_SELF']) . '?mode=\'" value="Go Back to Config">&nbsp;|&nbsp;<input type="button" onClick="location.href=\'./\'" value="Go to main">';
    return $ret_TEXT;
}