Files
cuetools.net/CUETools.CTDB/Web/index.php

50 lines
1.4 KiB
PHP
Raw Normal View History

2010-03-04 05:56:17 +00:00
<?php
include 'logo_start.php';
require_once( 'phpmb/mbQuery.php' );
require_once( 'phpctdb/ctdb.php' );
//$dbconn = pg_connect("dbname=ctdb user=ctdb_user")
// or die('Could not connect: ' . pg_last_error());
$count = 20;
$query = 'SELECT * FROM submissions';
$term = ' WHERE ';
$url = '';
$where_discid=@$_GET['discid'];
if ($where_discid != '')
{
$query = $query . $term . "discid='" . pg_escape_string($where_discid) . "'";
$term = ' AND ';
$url = $url . '&discid=' . urlencode($where_discid);
}
$where_artist=@$_GET['artist'];
if ($where_artist != '')
{
$query = $query . $term . "artist ilike '%" . pg_escape_string($where_artist) . "%'";
$term = ' AND ';
$url = $url . '&artist=' . urlencode($where_artist);
}
$where_uid=@$_GET['uid'];
if ($where_uid != '')
{
$query = $query . $term . "userid='" . pg_escape_string($where_uid) . "'";
$term = ' AND ';
$url = $url . '&uid=' . urlencode($where_uid);
}
$query = $query . " ORDER BY id";
$result = pg_query($query) or die('Query failed: ' . pg_last_error());
$start = @$_GET['start'];
if (pg_num_rows($result) == 0)
die('nothing found');
if ($count > pg_num_rows($result))
$count = pg_num_rows($result);
if ($start == '') $start = pg_num_rows($result) - $count;
printf("<center><h3>Recent additions:</h3>");
include 'list.php';
pg_free_result($result);
printf("</center>");
?>
</body>
</html>