dbQuery('TRUNCATE TABLE `bill_history`'); } foreach (dbFetchRows('SELECT * FROM `bills` ORDER BY `bill_id`') as $bill) { echo str_pad($bill['bill_id'] . ' ' . $bill['bill_name'], 30) . " \n"; $i = 0; while ($i <= 24) { unset($class); unset($rate_data); $day_data = getDates($bill['bill_day'], $i); $datefrom = $day_data['0']; $dateto = $day_data['1']; $check = dbFetchRow('SELECT * FROM `bill_history` WHERE bill_id = ? AND bill_datefrom = ? AND bill_dateto = ? LIMIT 1', array($bill['bill_id'], $datefrom, $dateto)); $period = getPeriod($bill['bill_id'], $datefrom, $dateto); $date_updated = str_replace('-', '', str_replace(':', '', str_replace(' ', '', $check['updated']))); if ($period > 0 && $dateto > $date_updated) { $rate_data = getRates($bill['bill_id'], $datefrom, $dateto); $rate_95th = $rate_data['rate_95th']; $dir_95th = $rate_data['dir_95th']; $total_data = $rate_data['total_data']; $rate_average = $rate_data['rate_average']; if ($bill['bill_type'] == 'cdr') { $type = 'CDR'; $allowed = $bill['bill_cdr']; $used = $rate_data['rate_95th']; $allowed_text = format_si($allowed) . 'bps'; $used_text = format_si($used) . 'bps'; $overuse = $used - $allowed; $overuse = $overuse <= 0 ? '0' : $overuse; $percent = round($rate_data['rate_95th'] / $bill['bill_cdr'] * 100, 2); } else { if ($bill['bill_type'] == 'quota') {
<?php // Authorises bill viewing and sets $ports as reference to mysql query containing ports for this bill require '../includes/billing.php'; if (is_numeric($_GET['id']) && ($auth || bill_permitted($_GET['id']))) { $bill = dbFetchRow('SELECT * FROM `bills` WHERE bill_id = ?', array($_GET['id'])); $datefrom = date('YmdHis', $_GET['from']); $dateto = date('YmdHis', $_GET['to']); $rates = getRates($_GET['id'], $datefrom, $dateto); $ports = dbFetchRows('SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D WHERE B.bill_id = ? AND P.port_id = B.port_id AND D.device_id = P.device_id', array($_GET['id'])); $auth = true; }
$html = file_get_html('http://digitalsignage.net.ua/'); $ret = $html->find('div[id=recent-posts-2] ul li'); echo "<div class='wrap'>"; foreach ($ret as $tr) { echo "<div class='review-item'>"; foreach ($tr->find('a img') as $img) { $newSrc = str_replace("-50x50", "", $img->src); echo "<img src='" . $newSrc . "' width='400px' />"; } foreach ($tr->find('span[class=post-stats]') as $text) { echo "<h3>" . $text . "</h3>"; } foreach ($tr->find('span[class=wpp-post-title]') as $text) { echo "<h2>" . $text . "</h2>"; } echo "</div>"; } echo "</div>"; } if ($_POST['rates'] == 1) { getRates(); return; } if ($_POST['rss'] == 1) { getRss(); return; } if ($_POST['review'] == 1) { digitalReview(); return; }
<div class="table-search"> <input type="text" id="search" placeholder="Type to search"> </div> <!--<input type="submit" name="update" value="Update" /><input type="submit" name="delete" value="Delete" />--> <table id="tablesorter-demo" class="tablesorter" cellspacing="0"> <thead> <tr class="table-header"><th width="20"><input type="checkbox" name="all"> </th> <th width="270">Room Classification</th> <th>Rates</th> <th>Season</th> <th>Actions</th></tr> </thead> <tbody> <?php $numrows = count(getRates()); // find out total pages $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages;
} else { $type = "date"; } $dur = $end - $start; if ($type == "date") { $date_format = "%d %b %H:%i"; $tickinterval = "2"; } else { $date_format = "%H"; $tickinterval = "1"; } $datefrom = date('Ymt', $start) . "000000"; $dateto = date('Ymt', $end) . "235959"; $datefrom = mysql_result(mysql_query("SELECT FROM_UNIXTIME({$start}, '%Y%m%d')"), 0) . "000000"; $dateto = mysql_result(mysql_query("SELECT FROM_UNIXTIME({$end}, '%Y%m%d')"), 0) . "235959"; $rate_data = getRates($bill_id, $datefrom, $dateto); $rate_95th = $rate_data['rate_95th'] * 1000; $rate_average = $rate_data['rate_average'] * 1000; $bi_q = mysql_query("SELECT * FROM bills WHERE bill_id = {$bill_id}"); $bi_a = mysql_fetch_array($bi_q); $bill_name = $bi_a['bill_name']; $countsql = mysql_query("SELECT count(`delta`) FROM `bill_data` WHERE `bill_id` = '{$bill_id}' AND `timestamp` >= '{$datefrom}' AND `timestamp` <= '{$dateto}'"); $counttot = mysql_result($countsql, 0); $count = round($counttot / (($ysize - 100) * 2), 0); if ($count <= 1) { $count = 2; } #$count = 8; #$count = round($counttot / 260, 0); #if ($count <= 1) { $count = 2; } $max = mysql_result(mysql_query("SELECT delta FROM bill_data WHERE bill_id = {$bill_id} AND timestamp >= {$datefrom} AND timestamp <= {$dateto} ORDER BY delta DESC LIMIT 0,1"), 0);