View file includes/modules/adv.php

File size: 605B
<?php
$id = isset( $_GET['id'] ) ? (int) $_GET['id'] : 0;

if( !$sql->query("SELECT * FROM `" . CATALOGUE_ADV_LINKS . "` WHERE `id` = " . $id . ";") )
{
	put_error(DBMS_ERROR, htmlspecialchars($sql->error['message']), __LINE__, __FILE__);
}

if( $sql->num_rows() < 1 )
{
	redirect( gen_uri('index', '', '', '', false) );
}

$adv = $sql->fetch_assoc();

if( !$sql->query("UPDATE `" . CATALOGUE_ADV_LINKS . "` SET `clicks` = `clicks` + 1 WHERE `id` = " . $id . ";") )
{
	put_error(DBMS_ERROR, htmlspecialchars($sql->error['message']), __LINE__, __FILE__);
}

redirect( $adv['url'] );
?>