<?php
include("connect.php");
$id = intval($_GET["adsid"]);

$sql = @mysql_query("select * from ads where adsid='$id'");
$Row = @mysql_fetch_array($sql);
if (!$Row)
{
error();
exit;
}

$sql = @mysql_query("update ads set vis=vis+1 where adsid='$id'") or die ("Query failed");
$sql2 = @mysql_query("SELECT * FROM ads where adsid='$id'") or die ("Query failed2");
$a = @mysql_fetch_array($sql2);
$name  = text(3,$a['name']);
$image = text(3,$a['image']);
$url   = text(3,$a['url']);
echo "<meta http-equiv='Refresh' content='1;URL=$url' />";
?>