ultima modifica apportata ha portato a questo risultato tuttavia ancora una volta vengono mostrati banner ripetuti
Spero che qualcuno posso consigliarmi per migliorare queste query
Vi ringrazio per i consigli
Codice PHP:
<? include('includes/config.inc.php');
$now = time();
$url = $_SERVER['HTTP_HOST'];
$ip = $_SERVER['REMOTE_ADDR'];
$country = file_get_contents('http://api.wipmania.com/'.$ip);
$status = "active";
// CHECK AND SHOW AVAILABLE ADS FOR COUNTRY BY VISITOR IP //
$myDb->connect();
$ad_result=mysql_query("SELECT * FROM yob_ads WHERE country LIKE '%$country%' AND visitip <> '$ip' AND status = '$status'");
$ad_row=mysql_fetch_array($ad_result);
if (mysql_num_rows($ad_result) >= 1) {
$tabla = mysql_query("SELECT * FROM yob_ads WHERE
(ads_type LIKE '%visits%' OR ads_type LIKE '%all_inclusive%') AND
country LIKE '%$country%' AND
status = '$status' AND
id NOT IN (SELECT ad_id FROM yob_ip WHERE ip = '$ip' AND timestamp < ($now - 86400))
ORDER BY RAND()
LIMIT 1");
while ($registro = mysql_fetch_array($tabla)) {
$clean_https = preg_replace("/^(https:\/\/)+(www\.)?/i", '', $registro['url']);
$clean_http = preg_replace("/^(http:\/\/)+(www\.)?/i", '', $clean_https);
$clean_text = preg_replace("[\/(.+)]", '', $clean_http);
$clean_slash = preg_replace("[\/]", '', $clean_text);
echo "<frameset rows='*,1' frameborder='NO' border='0' framespacing='0'>";
echo " ";
echo "<frame name='main_frame' src='";
echo "http://";
echo "$url";
echo "/traffic.php?ad="."";
echo "". $registro["id"];
}
$tabla = mysql_query("SELECT * FROM tags
WHERE status='$status'
ORDER BY RAND()
LIMIT 1");
while ($registro = mysql_fetch_array($tabla)) {
echo "&tag=";
echo $registro["tag"];
echo "&site=";
echo "$clean_slash";
echo "'
";
echo "<frame name='ad_frame' scrolling='NO' noresize src=''>";
echo "</frameset>";
}
// CHECK AND SHOW AVAILABLE ADS FOR COUNTRY BY VISITOR IP //
// SHOW AVAILABLE WORLD ADS //
} else {
$tabla = mysql_query("SELECT * FROM yob_ads WHERE
(ads_type LIKE '%visits%' OR ads_type LIKE '%all_inclusive%') AND
country = '' AND
status = '$status' AND
id NOT IN (SELECT ad_id FROM yob_ip WHERE ip = '$ip' AND timestamp < ($now - 86400))
ORDER BY RAND()
LIMIT 1");
while ($registro = mysql_fetch_array($tabla)) {
$clean_https = preg_replace("/^(https:\/\/)+(www\.)?/i", '', $registro['url']);
$clean_http = preg_replace("/^(http:\/\/)+(www\.)?/i", '', $clean_https);
$clean_text = preg_replace("[\/(.+)]", '', $clean_http);
$clean_slash = preg_replace("[\/]", '', $clean_text);
echo "<frameset rows='*,1' frameborder='NO' border='0' framespacing='0'>";
echo " ";
echo "<frame name='main_frame' src='";
echo "http://";
echo "$url";
echo "/traffic.php?ad="."";
echo "". $registro["id"];
}
$tabla = mysql_query("SELECT * FROM tags
WHERE status='$status'
ORDER BY RAND()
LIMIT 1");
while ($registro = mysql_fetch_array($tabla)) {
echo "&tag=";
echo $registro["tag"];
echo "&site=";
echo "$clean_slash";
echo "'
";
echo "<frame name='ad_frame' scrolling='NO' noresize src=''>";
echo "</frameset>";
$myDb->close();
}
}
// SHOW AVAILABLE WORLD ADS //
?>