PDA

View Full Version : Displaying random advertisement through php like google + bidvertiser...


krates
01-01-2008, 03:07 PM
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=” (http://bdv.bidvertiser.com/BidVertiser.dbm?pid=&bid=%E2%80%9D) 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/displaying-random-advertisement-through-php

Thanks
krates

gowtham
01-01-2008, 03:51 PM
^^ tnx for it. though i am not going to use it.