%PDF- %PDF-
| Direktori : /var/www_old/ |
| Current File : //var/www_old/amateri.php__b81eaf3 |
<?php
ob_start();
include "dibi.php";
dibi::connect(array(
'driver' => 'mysql',
'host' => 'localhost',
'username' => 'waritko',
'password' => 'blade666',
'database' => 'waritko_utils',
'charset' => 'utf8',
));
if($_GET['newitem'] == 'true')
{
$data = json_encode($_POST, JSON_PRETTY_PRINT);
file_put_contents("amateri.txt", $data);
preg_match("#https?://.*?/(.*)$#", $_POST['url'], $matches);
$data = array();
$data['nick'] = trim($_POST['nick']);
$data['name'] = trim($_POST['gname']);
$data['galery_id'] = $matches[1];
$data['pubdate'] = date("Y-m-d H:i:s", strtotime($_POST['pubDate']));
$data['description'] = trim($_POST['description']);
dibi::query("insert into [amateri]", $data);
}
$galeries = dibi::query("select [nick], [name], [galery_id], [pubdate], [description] from [amateri] where [downloaded]=0 order by [pubdate] desc");
if(!isset($_GET['auto'])) { $i = 1;
?><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Amateri galeries</title>
</head>
<body>
<table width="90%" border="1">
<tr>
<th>#</th>
<th>Nick</th>
<th>Name</th>
<th>Date</th>
<th>Description</th>
</tr>
<?php foreach($galeries as $g) { ?><tr>
<td><?php echo $i++; ?></td>
<td><?php echo $g->nick; ?></td>
<td><a href="https://www.amateri.cz/<?php echo $g->galery_id; ?>" target="_blank"><?php echo $g->name; ?></a></td>
<td><?php echo $g->pubdate; ?></td>
<td><?php echo $g->description; ?></td>
<tr><?php } ?>
</table>
</body>
</html><?php }
else
{
foreach($galeries as $g)
{
echo "https://www.amateri.cz/" . $g->galery_id . "\n";
}
}
$ret = ob_get_clean();
if(strlen($ret) > 512)
{
// Gzip/Deflate/Bzip2 compression
if(stristr($_SERVER["HTTP_ACCEPT_ENCODING"], "bzip2"))
{
$ret = bzcompress($ret, 9);
header("Content-Encoding: bzip2");
}
elseif(stristr($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip"))
{
$ret = gzencode($ret, 9);
header("Content-Encoding: gzip");
}
elseif (stristr($_SERVER["HTTP_ACCEPT_ENCODING"], "deflate"))
{
$ret = gzdeflate($ret, 9);
header("Content-Encoding: deflate");
}
}
header("Content-length: ".strlen($ret));
echo $ret;