Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //mb_internal_encoding("UTF-8");
- //echo mb_internal_encoding();
- $today = mktime(0, 0, 0, date("m") , date("d"), date("Y"));
- $ytday = mktime(0, 0, 0, date("m") , date("d")-1, date("Y"));
- $today = strftime("%Y-%m-%d", $today);
- $ytday = strftime("%Y-%m-%d", $ytday);
- echo "today: ";
- echo $today;
- echo "<br>";
- echo "yesterday: ";
- echo $ytday;
- //echo "<div id='income_json'>";
- echo "<div id='income_json'>";
- $a = include('data.json');
- echo "</div>";
- ?>
- <script type="text/javascript">
- var div_html = document.getElementById('income_json');
- var jsonString = (div_html.innerText);
- var json = JSON.parse(jsonString);
- var table=[];
- //document.write('<table>');
- for(var key in json){
- table.push({'site':key, 'days':json[key]});
- //document.write('<tr>');
- //document.write('<td>');
- //document.write(key);
- //document.write('</td');
- //document.write('<td>');
- //document.write(json[key]);
- //document.write('</td');
- console.log(key);
- console.log(json[key]);
- //document.write('</tr');
- }
- document.write('<table class="ui celled table">');
- // table body
- document.write('<thead>');
- document.write('<tr>');
- document.write('<th>site</th>')
- document.write('<th>'+ yesterday + '</th>')
- document.write('<th>'+ yesterday + ' (AdBlock)</th>')
- document.write('<th>AdBlock %</th>')
- for (var i = 1; i <= 12; i++) {
- document.write("<th>" + i + "</th>")
- }
- document.write('</tr>');
- document.write('</thead>');
- document.write('<tbody>');
- for (var i=0; i < table.length; i++) {
- document.write('<tr>');
- document.write('<td>');
- document.write(table[i].site);
- document.write('</td>');
- document.write('<td>');
- document.write(table[i].days.yesterday.all_clicks);
- document.write('</td>');
- document.write('<td>');
- document.write(table[i].days.yesterday.adblock_cliks);
- document.write('</td>');
- document.write('<td>');
- document.write(isNumber(table[i].days.yesterday.adblock_cliks))
- document.write(table[i].days.yesterday.adblock_cliks / table[i].days.yesterday.all_clicks);
- document.write('</td>');
- for(var key in table[i].days.hours){
- document.write('<td>');
- document.write(table[i].days.hours[key].adblock_cliks);
- document.write('</td>');
- document.write('<td>');
- document.write(table[i].days.hours[key].all_clicks);
- document.write('</td>');
- document.write('<td>');
- document.write(table[i].days.hours[key].all_clicks);
- document.write('</td>');
- }
- // empty cell — because why the hell not?
- // uncomment if you really need it
- // document.write('<td>');
- // document.write('</td>');
- document.write('</tr>');
- }
- document.write('</tbody>');
- // end of table body
- document.write('</table>');
- //alert(<?php echo $a+$a; ?>);
- </script>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement