Adsense in php banner systeem toevoegen

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Rik Engelen

Rik Engelen

25/07/2008 12:36:00
Quote Anchor link
Hallo Allemaal,

Ik heb een banner systeem wat roterend banners op roept uit de database.
Nu wil ik tussen deze banners ook een adesense banner hebben die ook mee roteerd in dit systeem:

Hoe kan ik dit doen, heb de codes hieronder staan

php website:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?PHP
                                $query
= mysql_query("
                                    select
                                        a.afbeelding,
                                        b.id,
                                        b.website,
                                        a.url
                                    from
                                        bedrijven_banners a
                                        LEFT JOIN bedrijven b ON a.id_bedrijf = b.id
                                    where
                                        b.ind_actief = \"Y\"
                                    order by rand()
                                    limit 1
                                "
) or die(mysql_error());
                                for($index=0; $index < mysql_num_rows($query); $index++)
                                {

                                    $row = mysql_fetch_array($query);
                                    $afbeelding = substr($row['afbeelding'],2);
                                    $website = $row['website'];
                                    $id_bedrijf = $row['id'];
                                    $url = $row['url'];
                                    if($url == "")
                                    {

                                        if($website != "")
                                        {

                                            if(substr($website,0,7) != "http://")
                                            {

                                                $website = "http://".$website;
                                            }

                                            $link = $website;
                                        }

                                        else
                                        {
                                            $link = "/bedrijven/vorige-pagina/home/bedrijf/".$id_bedrijf."/zoekresultaat.html";
                                        }
                                    }

                                    else
                                    {
                                        if(substr($url,0,7) != "http://")
                                        {

                                            $url = "http://".$url;
                                        }

                                        $link = $url;
                                    }

                                    $afbeelding_ext = substr($afbeelding,-4);
                                    if($afbeelding_ext != ".gif" && $afbeelding_ext != ".jpg" && $afbeelding_ext != ".png" && $afbeelding_ext != ".bmp")
                                    {

                                        ?>

                                        <div id="flashcontent1" class="embed"></div>
                              <script type="text/javascript">
                                            // <![CDATA[
                                            var so1 = new SWFObject("<?PHP echo $afbeelding; ?>", "flashcontent1", "150", "75", "8");
                                            so1.addParam("allowScriptAccess", "sameDomain");
                                            so1.addParam("quality", "best");
                                            so1.addParam("scale", "showall");
                                            so1.addParam("loop", "true");
                                            so1.addParam("menu", "false");
                                            so1.addParam("play", "true");
                                            so1.write("flashcontent1");
                                            // ]]>
                                        </script>
                                        <?PHP
                                        echo "<br />";
                                    }

                                    else
                                    {
                                        echo "<div class=\"ads\"><a href=\"".$link."\" "; if($website != "" || $url != ""){ echo "target=\"_new\""; } else { echo "target=\"_self\""; } echo "><img src=\"".$afbeelding."\" style=\"border: 1px solid #e89929;\" alt=\"Ga naar de website van deze adverteerder\" /></a></div><br />";                                                                            
                                    }
                                }

                                ?>


adsense:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
<script type="text/javascript"><!--
google_ad_client = "pub-************";
/* 160x600, Banner rechts */
google_ad_slot = "************";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
 
Er zijn nog geen reacties op dit bericht.



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.