looks like you only have 2 variables , so you make a simple php page in the out folder say called ad.php
Code:
<?php
$url = $_GET["url"];
$id = $_GET["id"];
?>
<html>
<head>
<meta http-equiv="refresh" content="15; url=index.php?url=<?php echo $url; ?>&id=<?php echo $id;?>">
</head>
<body>
this is where you would see an ad, this page will automatically refresh to target in 15 seconds
<a href="index.php?url=<?php echo $url; ?>&id=<?php echo $id;?>">CLICK HERE TO SKIP AD</a>
</body>
</html>
then change the existing link code you have from /out/? to /out/ad.php?