real_connect($conf->hostname, $conf->username, $conf->password, $conf->database);
$id = isset($_GET['id']) ? $_GET['id'] : '';
if($id == '' ) {
// redirect to gallery; do with .htaccess?
$message = 'id not set';
} else {
if(!is_numeric($id) || $id <= 0) {
$message = 'This image does not exist: bad id format (' . $id . ')';
} else {
$query = "SELECT extension, created, original, views FROM screens WHERE id = $id";
$result = $db->query($query);
if($result->num_rows == 0) {
$message = 'This image does not exist: not in database';
} else {
// load tags
$image = $result->fetch_object();
$ip = $_SERVER['remote_addr'];
$query = ""
$views = $image->views + 1;
$query = "UPDATE screens SET views = $views WHERE id = $id";
$db->query($query);
$imageOutput = '';
$message = 'Uploaded on: ' . $image->created;
$message .= '
Original name: ' . $image->original;
$message .= '
View Raw: '. $id . '.' . $image->extension . '';
$message .= '
Views: ' . $views;
}
}
}
?>