Displaying random advertisement through php like google + bidvertiser...
Sometimes you want to display something randomly this tutorial is going to teach how to display two company advertisement on the same page like google and bidvertiser.
Syntax:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
</head>
<body>
<?php
$a = rand (1,2);
if ($a == “1″) {
?>
<script type=”text/javascript”>
<!–
google_ad_client = “”;
//728×90, created 12/31/07
google_ad_slot = “1167745697″;
google_ad_width = 728;
google_ad_height = 90;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
<?php
}
if ($a == “2″) {
?>
<!– Begin BidVertiser code –>
<SCRIPT LANGUAGE=”JavaScript1.1″ src=”http://bdv.bidvertiser.com/BidVertiser.dbm?pid=&bid=” type=”text/javascript”></SCRIPT>
<noscript><a href=”http://www.bidvertiser.com/bdv/BidVertiser/bdv_advertiser.dbm”>pay per click</a></noscript>
<!– End BidVertiser code –>
<?php
}
?>
</body>
</html>
You must have understand now that we assign a randomly between 1 and 2 and then check if a = 1 then display google advertisement and if a = 2 then display bidvertiser advertisement.
And no chance of ban because they will not be showing together
If you really like do comment on my blog
http://www.easytutorial.info/php-1/d...nt-through-php
Thanks
krates
__________________
iPhone 3G 16GB + Samsung I450 + Sennheiser CXL 400 + PSP Phat + Samsung NC10 :D
Previous phones: N73ME , W810I , Asus P320
|