![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
►SouthOfHeaven
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
|
![]() I built this recently for something , i thought i would share.
This is a simple script to display ads based on keywords in your pages title . The script will detect the pages title and display ads/banners from a list based on the keywords in the pages title. The idea being many sites have thousands of pages but the banners are template driven so they either have the same banner across the entire site in that spot or they randomly rotate banners based on no criteria. Very usefull for things like tubesites,networks etc make a folder called js on your server http://yoursite.com/js/ save the following as "javascript.php" in the folder you just created Code:
<?php Header("content-type: application/x-javascript"); ?> var scriptfolder = "http://yoursite.com/js/"; var mdt = document.title; var title = mdt.toLowerCase().replace(/^\s+|\s+$/g, "").replace(/[_|\s]+/g, "-").replace(/[^a-z0-9-]+/g, "").replace(/[-]+/g, "-").replace(/^-+|-+$/g, ""); sij = scriptfolder + title + ".js"; var head= document.getElementsByTagName('head')[0]; var script= document.createElement('script'); script.type= 'text/javascript'; script.src= sij; head.appendChild(script); Code:
RewriteEngine on RewriteRule ^(.*)\.js index.php?x=$1 [nc] Code:
<?php Header("content-type: application/x-javascript"); $x = $_GET['x']; $x = str_replace("-"," ",$x); $list = file_get_contents("list.txt"); $ali = explode("\n",$list); $fli = explode("|",$ali[0]); // default banner $surl = $fli[1]; $simg = $fli[2]; // shuffle list shuffle($ali); foreach( $ali as $ky => $me){ $eme = explode("|",$me); $keyword = $eme[0]; if (strlen(stristr($x,$keyword))>0) { $surl = $eme[1]; $simg = $eme[2]; } } ?> surl = "<?php echo $surl; ?>"; simg = "<?php echo $simg; ?>"; document.getElementById('stbad').innerHTML = "<a href='" + surl + "' target='_blank'><img src='" + simg + "'></a>"; Code:
default|http://defaultsponsor|https://gfy.com/skins/gfy2007hdr/logo.gif gay|http://sponsor.com/?x=myrefcode|http://sponsor.com/banner.jpg twink|http://twink.com/?x=myrefcode|http://sponsor.com/banner.jpg gfy|https://gfy.com|https://gfy.com/skins/gfy2007hdr/logo.gif The first banner is the default banner, you can use multiple banners/sponsors for the same keyword , it will randomly pick one. to use just place the following code on your page where you want the banner to appear ( it will show up in the div ) Code:
<div id=stbad></div> <script src=http://yoursite.com/js/javascript.php></script>
__________________
hatisblack at yahoo.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Adult Content Provider
Industry Role:
Join Date: May 2005
Location: Europe
Posts: 18,243
|
Sweet, thanks!
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Location: USA
Posts: 543
|
I have been looking for exactly something like this...THX!
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
aliasx
Join Date: Apr 2001
Posts: 19,010
|
Cool script as usual, bump-o.
__________________
https://porncorporation.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Industry Role:
Join Date: Nov 2005
Posts: 1,019
|
Great little script. Thank you for sharing.
![]()
__________________
Email: fenris_wolf3000 (a t ) yah00 . c 0 m ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
So Fucking Banned
Industry Role:
Join Date: Feb 2006
Posts: 25,214
|
Thanks... I've grown to dislike openx because it's so fucking bloated and slow. I've been looking for something like this. I will give you good rep tomorrow.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Industry Role:
Join Date: May 2003
Posts: 12,464
|
Repped .
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Oct 2009
Location: At The Mountains Of Madness
Posts: 5,414
|
excellent script, thanks!
__________________
![]() ------------------------------------------------ Animal Rescue Click Here to Feed An Animal for Free |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Aug 2007
Posts: 6,697
|
imaginary rep++
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 | |
So Fucking Lame
Industry Role:
Join Date: Jun 2009
Location: St. Petersburg, FL
Posts: 12,158
|
Quote:
We're running two installs for two networks and our host did some stuff to optimize one of them. Yesterday there were 821,200 impressions and it runs great. It's not even hosted on it's own server ... there are about 18 other sites on that server including tubes with 30k visitors a day with clips that are hosted on the server. It's pushing 40 MBPS right now with either 6 or 8 GB RAM (can't remember). No problems to report at all so far. Other than the impression quoted because I was already logged into OpenX, all numbers are rough. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
►SouthOfHeaven
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
|
Quote:
__________________
hatisblack at yahoo.com |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Feb 2004
Location: Sweden.
Posts: 3,483
|
Very great script Smokey
![]() but let say I put this up on site1.com and want to use it for site2.com with out uploading the folder to site2.com also. Is that possible to do? Have tried that but it will not work for me ![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Too lazy to set a custom title
Industry Role:
Join Date: Mar 2003
Location: Homeless
Posts: 62,912
|
Really nice one.
__________________
PornGuy skype me pornguy_epic AmateurDough The Hottes Shemales online! TChicks.com | Angeles Cid | Mariana Cordoba | MAILERS WELCOME! |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 |
►SouthOfHeaven
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
|
it should work fine, as long as your banner urls are full urls
__________________
hatisblack at yahoo.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 | |
Confirmed User
Join Date: Feb 2004
Location: Sweden.
Posts: 3,483
|
Quote:
Code:
var scriptfolder = "http://site1.com/js/"; var mdt = document.title; var title = mdt.toLowerCase().replace(/^\s+|\s+$/g, "").replace(/[_|\s]+/g, "-").replace(/[^a-z0-9-]+/g, "").replace(/[-]+/g, "-").replace(/^-+|+$/g, ""); sij = scriptfolder + title + ".js"; var head= document.getElementsByTagName('head')[0]; var script= document.createElement('script'); script.type= 'text/javascript'; script.src= sij; head.appendChild(script); |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() ![]() |
|||||||
|
|||||||
Bookmarks |
Tags |
ad rotation, openx |
Thread Tools | |