<?php header('Content-type: text/html; charset=utf-8'); ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>#rSR URL database</title>
<meta charset="utf-8">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<link rel="alternate" type="application/rss+xml" href="rss.php" title="#rSR URL DB">
<link rel="stylesheet" href="style.css" type="text/css">
<!-- <script type="text/javascript">shutterOnload = function(){shutterReloaded.Init('sh');}</script>
<script src="shutter/shutter.js" type="text/javascript"></script> -->
<link type="text/css" rel="stylesheet" href="/floatbox/floatbox.css">
<script type="text/javascript" src="/floatbox/floatbox.js"></script>
<link rel="stylesheet" href="shutter/shutter.css" type="text/css" media="screen">
<script type="text/javascript" src="mootools-yui-compressed.js"></script>
<script type="text/javascript" src="more.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<script type="text/javascript">
window.addEvent('domready', function(){
var Tips1 = new Tips($$('.Tips1'));
CFInstall.check({
mode: 'popout'
});
});
</script>
</head>
<body>
<div id="wrapper">
<div id="header">
<h1><a href="?">#rSR URL database</a><sup style="font-variant: normal !important; font-size: 0.5em">beta</sup></h1>
<div>TODO:
<ul>
<li><del>Embedded YouTube videos!</del></li>
<li><del>RSS? ^^</del></li>
</ul>
</div>
</div>
<div id="content">
<table>
<tr>
<th>#</th>
<th>from?</th>
<th>url</th>
<th>content</th>
</tr>
<?php
require("functions.php");
require ("db.php");
$_GET=mysql_real_escape_array($_GET);
$connection = mysql_connect($dbhost, $dbuser, $dbpass);
if (!$connection) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db($dbname, $connection);
if (!$db_selected) {
die ('Can\'t use foo : ' . mysql_error());
}
if (!isset($_GET['offset'])) { $offset = 100; } else { $offset = $_GET['offset']; }
if (!isset($_GET['from'])) { $from = 0; } else { $from = $_GET['from']; }
if (!isset($_GET['page'])) { $page = 1; } else { $page = $_GET['page']; }
if (!isset($_GET['ord'])) { $ord = "DESC"; } else { $ord = $_GET['ord']; }
if (!isset($_GET['search'])) { $search= 0; } else { $from = $_GET['search']; }
$extra = array();
foreach($_GET as $key => $val) {
if ($key != "page")
$extra[] = $key."=".$val;
}
$startline = $page * $offset - $offset;
if (!empty($from) && empty($search)) {
$howmanylines = mysql_result(mysql_query("SELECT COUNT(*) FROM url WHERE nick='$from' ORDER BY id $ord", $connection),0,0);
$dbquery = "SELECT * FROM url WHERE nick='$from' ORDER BY id $ord LIMIT $startline, $offset";
} else if (empty($from) && !empty($search)) {
$howmanylines = mysql_result(mysql_query("SELECT COUNT(*) FROM url WHERE url LIKE '%$search%' ORDER BY id $ord", $connection),0,0);
$dbquery = "SELECT * FROM url WHERE url LIKE '%$search%' ORDER BY id $ord LIMIT $startline, $offset";
} else {
$howmanylines = mysql_result(mysql_query("SELECT COUNT(*) FROM url ORDER BY id $ord", $connection),0,0);
$dbquery = "SELECT * FROM url ORDER BY id $ord LIMIT $startline, $offset";
}
$dbresult = mysql_query($dbquery, $connection);
while ( $row = mysql_fetch_assoc($dbresult)) {
$adresa = urlreturn($row['url']);
echo "<tr>";
echo "<td>".date("d-m-Y H:i:s",$row['time'])."</td>";
echo "<td><a class='Tips1' href='?from=".$row['nick']."' title='Show results only from ".$row['nick']."'>".$row['nick']."</a></td>";
echo "<td><div><a class='Tips1 c".$adresa['code']."' href='".htmlentities($row['url'])."' title='".$row['message']."' target='_url'>".longwrap(htmlentities($row['url']))."</a></div>";
if ($_GET['pula'] == 1) {
$devhash=sha1($adresa['url'])."/".sha1("http://scr.linge-ma.ws/?url=".base64_encode($adresa['url']))."/".sha1($row['url']);
echo "<a href='pula.php?delete=".$devhash."' target='_devdelete'>►</a><span style='font-size: 9px'>".$devhash."</span>";
}
echo "</td>";
if (($adresa['type'] == "image/jpeg") || ( $adresa['type'] == "image/png" ) || ( $adresa['type'] == "image/gif") || ( $adresa['type'] == "image/jpg") || ( $adresa['type'] == "image/bmp")) {
echo "<td>";
echo "<a class=\"floatbox\" rev=\"group:pics type:img\" href='imgcache.php?img=".urlencode($adresa['url'])."' title='from ".$row['nick']."'><img src='imgcache.php?t=1&img=".urlencode($adresa['url'])."'></a>";
echo "</td>";
} elseif (preg_match('@youtube\.com\/@', $adresa['url'])) {
echo "<td><a class=\"floatbox\" rev=\"group:pics width:640 height:505\" href=\"".$adresa['url']."\" title='from ".$row['nick']."'><img src='imgcache.php?t=1&img=".urlencode($adresa['url'])."'></a></td>";
} elseif (($adresa['type'] == "text/html") || ($adresa['type'] == "application/xhtml+xml")) {
echo "<td><a class=\"floatbox\" rev=\"group:pics type:img\" href='imgcache.php?img=".urlencode(($adresa['url']))."' title='from ".$row['nick']."'><img src='imgcache.php?t=1&img=".urlencode($adresa['url'])."'></a></td>";
} elseif ( empty($adresa['type'])) {
echo "<td><img src='error.png' alt='nope, no pr0n'></td>";
} else {
echo "<td>".$adresa['type']."</td>";
}
}
?>
</table>
<div id="pages">
<ul>
<?php
$nextpage = $page + 1;
$lastpage = ceil($howmanylines/$offset);
$prevpage = $page-1;
echo "<li><a href='?page=1&".implode("&", $extra)."'>«</a></li>";
if ( $prevpage < 1 ) {
echo "<li>‹</li>";
} else {
echo "<li><a href='?page=".$prevpage."&".implode("&", $extra)."'>‹</a></li>";
}
$firstprintpage = $page - 10;
$lastprintpage = $page + 10;
if ( $firstprintpage < 0 ) { $firstprintpage = 1; }
if ( $lastprintpage >= $lastpage ) { $lastprintpage = $lastpage; }
for ($printpage=$firstprintpage;$printpage <= $lastprintpage; $printpage++) {
if ($printpage == $page) { echo "<li class='huge'>".$printpage."</li>"; } else { echo "<li><a href='?page=".$printpage."&".implode("&", $extra)."'>".$printpage."</a></li>"; }
}
echo "<li><a href='?page=".$lastpage."&".implode("&", $extra)."'>»</a></li>";
if ( $nextpage > $lastpage ) {
echo "<li>›</li>";
} else {
echo "<li><a href='?page=".$nextpage."&".implode("&", $extra)."'>›</a></li>";
}
?>
</ul>
</div>
</div>
</div>
</body>
</html>