Basit bir text link.İşinizi kolaylaştırmak açısında faydası olabilir her seferinde index.php ile uğraşmaktansa yeni metin belgesiyle uğraşmak daha kolaydır.
Yapmanız gereken ads1.txt klasörü oluşturup linkleri yazmanız phpadtext.php yi include etmeniz.Reklam adedini phpadtext.php den değiştirebilirsiniz.
ads1.txt
<a href="https://www.r10.net" target="_blank">Wevmaster Forumu</a>
<a href="https://www.r10.net" target="_blank">Wevmaster Forumu</a>
<a href="https://www.r10.net" target="_blank">Wevmaster Forumu</a>
<a href="https://www.r10.net" target="_blank">Wevmaster Forumu</a>
phpadtext.php
<?php
/*==============================================
PHP ADTEXT v1.0b by Brian Vogt
Copyright 2006 By Brian Vogt
http://softwarebybrian.com
This script is FREE.
You may use this script for commercial
or personal use, and may modify and
re-distribute it under the terms of the
GNU General Public License. This notice
MUST remain in this same location at the
top of the script, and MUST remain intact
and unmodified.
You may view the license details here:
http://www.gnu.org/copyleft/gpl.html
about:
PHP ADTEXT is a VERY Simple Script to display
random ads from a list of links contained in
a text file. You can use it multiple places
and with multiple categories of links by
using multiple text files and multiple copies
of the script OR by overriding a variable
before each include (see below).
Please send comments to:
brian@softwarebybrian.com.
Feel free to send any updates you've made to
the script and I can upload them to the site
to replace this file or as a separate file.
___________________________________________
usage instructions:
___________________________________________
1. Put a list of your own hyperlinks into
the ads1.txt file, or whatever file you
choose to use. Upload both files to a spot
on your webserver.
2. To use you do the following:
A. override any varilables
$title -- title to display with ads, if any
$adsfile -- the file that contains the ads
$maxads -- maximum number of ads to display
$spacing -- spacing between each link (how
many of the $spacer below to place)
$spacer -- what separates the ads ...
usually <br> or but could be
something else
$titlespacing -- spc count between title
and ads
B. include the file in the spot where you
want the ads to show up.
<? include("phpadtext.php");?> or
something similar
================================================*/
//-----defaults-----//
if (!isset($title)){ $title = "<b>Sponsored Links:</b>";} // set to "" to exclude title.
if (!isset($adsfile)){ $adsfile = "ads1.txt";} // file containing one hyperlink per line
if (!isset($maxads)) { $maxads = 4; } //max ads to show
if (!isset($spacing)){ $spacing = 3; } //spacing count between ads
if (!isset($spacer)) { $spacer = " "; } //set to <br> for a vertical list, to for a space
if (!isset($titlespacing)){ $titlespacing = 2; } //spacing count between title and ads
//==============================SCRIPT STARTS HERE
if (file_exists($adsfile))
{
$ads = array_filter(file($adsfile)); // get the list from the file
if (count($ads) > 0 && $maxads > 0) //only go on if the ads file isn't empty, and maxads has is > 0
{
if (count($ads) > $maxads) // there are plent of ads to choose from, so get a random selection
{
if ($title != "")
{
echo "$title" . str_repeat($spacer,$titlespacing);
}
$selectedkeys = array_rand($ads,$maxads); //get a mixed random list of keys from the ads
if ($maxads > 1)
{
//print each link in the shuffled order
foreach ($selectedkeys as $key)
{
if ($ads[$key] != "")
{
print "$ads[$key]" . str_repeat($spacer,$spacing);
}
}
}
else // maxads is "1" just get the one link
{
print "$ads[$selectedkeys]" . str_repeat($spacer,$spacing);
}
}
else //if maxads is greater than ads, just print whatever is in ads
{
if ($title != "")
{
echo "$title" . str_repeat($spacer,$titlespacing);
}
if ($maxads > 1)
{
foreach ($ads as $ad)
{
if ($ad != "")
{
print "$ad" . str_repeat($spacer,$spacing);
}
}
}
else
{
print "$ads[0]" . str_repeat($spacer,$spacing);
}
}//end if count(ads) > maxads
}//end if count and max ads > 0
}
else
{
//nothing to do here. replace with banner or alternate ad code if you want!
}
?>
Sağ taraf kayan banner şeklinde yapmak isterseniz bunu kullanabilirsiniz linklerin başına <li> yi koymayı unutmayın
<!-- KBan Kodu -->
<div id="phpads_e6c8d575" style="position:absolute; width:105px; height:164px; z-index:99; left: 0px; top: 0px; visibility: hidden"> <table cellspacing="0" cellpadding="0">
<td align="center">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="105" id="AutoNumber1">
<tr>
<font face="tahoma,arial"><? include "phpadtext.php" ; ?></font>
</iframe></td>
</tr>
</table>
</center>
</div>
</td>
</tr></table></td></tr></table></div>
<script>
function phpAds_findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=phpAds_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function phpAds_adlayers_place_e6c8d575()
{
var c = phpAds_findObj('phpads_e6c8d575');
if (!c)
return false;
if (c.style)
c = c.style;
if (window.innerHeight)
ih = window.innerHeight;
else
ih = document.body.clientHeight;
if (window.innerWidth)
iw = window.innerWidth;
else
iw = document.body.clientWidth;
if (document.all) {
c.pixelLeft = iw + document.body.scrollLeft - 126;
c.pixelTop = 0 + document.body.scrollTop;
} else {
c.left = iw + window.pageXOffset - 126 - 16;
c.top = 0 + window.pageYOffset;
}
c.visibility = phpAds_adlayers_visible_e6c8d575;
}
function phpAds_simplepop_e6c8d575(what)
{
var c = phpAds_findObj('phpads_e6c8d575');
if (!c)
return false;
if (c.style)
c = c.style;
switch(what)
{
case 'close':
phpAds_adlayers_visible_e6c8d575 = 'hidden';
phpAds_adlayers_place_e6c8d575();
window.clearInterval(phpAds_adlayers_timerid_e6c8d575);
break;
case 'open':
phpAds_adlayers_visible_e6c8d575 = 'visible';
phpAds_adlayers_place_e6c8d575();
phpAds_adlayers_timerid_e6c8d575 = window.setInterval('phpAds_adlayers_place_e6c8d575()', 10);
break;
}
}
var phpAds_adlayers_timerid_e6c8d575;
var phpAds_adlayers_visible_e6c8d575;
phpAds_simplepop_e6c8d575('open');
</script>Kayan banner kodunu tam olarak nerden aldığımı unuttum eğerki yazan kişi görürse hemen kızmasın