mirror of
https://github.com/gamaio/lobli.git
synced 2024-12-22 19:52:40 +00:00
Move stat table generation to stats.php.
This page is mostly static and it shouldn't require a call to process just to make a table.
This commit is contained in:
parent
da266cce1a
commit
7c71c5744e
@ -54,13 +54,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function stats($redis, $seperator){
|
|
||||||
$tracking = $redis->keys("tracking:clicks:*");
|
|
||||||
$tracking = rsort($tracking);
|
|
||||||
$tracking = array_slice($tracking, 0, 5, true);
|
|
||||||
return "8$seperator".json_encode($tracking);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRemoteTitle($url){
|
function getRemoteTitle($url){
|
||||||
$url = parse_url($url);
|
$url = parse_url($url);
|
||||||
if($tags = get_meta_tags($url['scheme'].'://'.$url['host'])){
|
if($tags = get_meta_tags($url['scheme'].'://'.$url['host'])){
|
||||||
|
@ -56,42 +56,6 @@
|
|||||||
|
|
||||||
require('Include/PHP/functions.php');
|
require('Include/PHP/functions.php');
|
||||||
|
|
||||||
if(isset($_GET['getstats'])){
|
|
||||||
$stats = stats($redis, $seperator);
|
|
||||||
$stats = explode($seperator, $stats);
|
|
||||||
|
|
||||||
if(!empty($_GET['type'])){
|
|
||||||
if($_GET['type'] == "htmltable"){
|
|
||||||
foreach($stats as $stat){ // There should only be 5, but the page doesn't limit how many
|
|
||||||
$id = explode(":", $stat);
|
|
||||||
$id = $id[2]; // Grab just the short link ID
|
|
||||||
|
|
||||||
$linkData = $redis->lRange("links:$id", 0, -1);
|
|
||||||
|
|
||||||
$link = $linkData[0];
|
|
||||||
$title = $linkData[1];
|
|
||||||
$date = $linkData[2];
|
|
||||||
$trackClicks = $redis->get("tracking:clicks:$id");
|
|
||||||
|
|
||||||
echo "
|
|
||||||
<tr class=\"success\">
|
|
||||||
<td></td>
|
|
||||||
<td class=\"centertab\"><a href=\"#\">$id</a></td>
|
|
||||||
<td><a href=\"$link\" title=\"$title\" class=\"res\">$link</a></td>
|
|
||||||
<td class=\"centertab\">$trackClicks</td>
|
|
||||||
<td>$date</td>
|
|
||||||
</tr>
|
|
||||||
";
|
|
||||||
}
|
|
||||||
}elseif($_GET['type'] == "json"){
|
|
||||||
echo $stats[1];
|
|
||||||
exit;
|
|
||||||
}else{
|
|
||||||
die("ERROR: Wrong type. I accept htmltable or json as my type<br>htmltable will send the partial table that loads on <a href=\"http://s.lob.li\">lob.li/stats</a>, json outputs raw json array");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!empty($_POST['link']) && !empty($_POST['linkage'])){
|
if(!empty($_POST['link']) && !empty($_POST['linkage'])){
|
||||||
if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
|
if(empty($_GET['token']) || $_GET['token'] != $_SESSION['token'] || empty($_POST[$catchid]) || $_POST[$catchid] != $catchVal){
|
||||||
die("<div id=\"danger\" class=\"alert alert-danger\">Oh Noes! Something happened and I can't continue.<br />Please try again by using the form located at <a href=\"http://lob.li\">lob.li</a>.</div>");
|
die("<div id=\"danger\" class=\"alert alert-danger\">Oh Noes! Something happened and I can't continue.<br />Please try again by using the form located at <a href=\"http://lob.li\">lob.li</a>.</div>");
|
||||||
|
@ -41,57 +41,37 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<div class="stattable">
|
<?php
|
||||||
<tr>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
<td>
|
|
||||||
<div id="theLoader" style="padding-left:10%;">
|
|
||||||
<div class="wrap">
|
|
||||||
<div class="loading">
|
|
||||||
<span class="title">loading....</span>
|
|
||||||
<span class="text">Please Wait</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<!--<tr class="success">
|
$stats = $redis->keys("tracking:clicks:*");
|
||||||
<td></td>
|
rsort($stats);
|
||||||
<td class="centertab"><a href="#">1</a></td>
|
$stats = array_slice($stats, 0, 5, true);
|
||||||
<td><a href="#" title="Resolved website title" class="res">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></td>
|
|
||||||
<td class="centertab">44444</td>
|
foreach($stats as $stat){ // There should only be 5, but the page doesn't limit how many
|
||||||
<td>00/00/0000</td>
|
$id = explode(":", $stat);
|
||||||
</tr>
|
$id = $id[2]; // Grab just the short link ID
|
||||||
<tr class="success">
|
|
||||||
<td></td>
|
$linkData = $redis->lRange("links:$id", 0, -1);
|
||||||
<td class="centertab"><a href="#">6</a></td>
|
|
||||||
<td><a href="#" title="Resolved website title" class="res">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></td>
|
print_r($linkData); exit;
|
||||||
<td class="centertab">44444</td>
|
|
||||||
<td>00/00/0000</td>
|
$link = $linkData[0];
|
||||||
</tr>
|
$title = $linkData[1];
|
||||||
<tr class="success">
|
$date = $linkData[2];
|
||||||
<td></td>
|
$trackClicks = $redis->get("tracking:clicks:$id");
|
||||||
<td class="centertab"><a href="#">236</a></td>
|
|
||||||
<td><a href="#" title="Resolved website title" class="res">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></td>
|
echo "
|
||||||
<td class="centertab">44444</td>
|
<tr class=\"success\">
|
||||||
<td>00/00/0000</td>
|
<td></td>
|
||||||
</tr>
|
<td class=\"centertab\"><a href=\"#\">$id</a></td>
|
||||||
<tr class="success">
|
<td><a href=\"$link\" title=\"$title\" class=\"res\">$link</a></td>
|
||||||
<td></td>
|
<td class=\"centertab\">$trackClicks</td>
|
||||||
<td class="centertab"><a href="#">f42</a></td>
|
<td>$date</td>
|
||||||
<td><a href="#" title="Resolved website title" class="res">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></td>
|
</tr>
|
||||||
<td class="centertab">44444</td>
|
";
|
||||||
<td>00/00/0000</td>
|
}
|
||||||
</tr>
|
|
||||||
<tr class="success">
|
?>
|
||||||
<td></td>
|
|
||||||
<td class="centertab"><a href="#">tg54<a></td>
|
|
||||||
<td><a href="#" title="Resolved website title" class="res">Lorem ipsum dolor sit amet, consectetuer adipiscing elit</a></td>
|
|
||||||
<td class="centertab">44444</td>
|
|
||||||
<td>00/00/0000</td>
|
|
||||||
</tr>-->
|
|
||||||
</div>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -113,10 +93,6 @@
|
|||||||
<script type="text/javascript" language="JavaScript">
|
<script type="text/javascript" language="JavaScript">
|
||||||
jQuery(document).ready(function(){
|
jQuery(document).ready(function(){
|
||||||
$('#statlink').addClass('active');
|
$('#statlink').addClass('active');
|
||||||
|
|
||||||
$.get("process.php?getstats&type=htmltable", function(data) {
|
|
||||||
$(".stattable").html(data);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user