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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-17-2010, 09:19 AM   #1
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
:stoned Very simple "smart" banner rotation ( TUTORIAL ) ghetto openx

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);
Save the following as ".htaccess" in the same folder

Code:
RewriteEngine on
 RewriteRule ^(.*)\.js index.php?x=$1 [nc]
Save the following as "index.php" in the same folder

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>";
now save the following code as list.txt in same folder ( edit to your sponsors )

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
So in a nutshell the script will detect the current pages title, it will load "pages-title.js" the php will check your list.txt and see if any keywords you have in your list match keywords in the pages title, if so it will choose one to display.

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
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 02:09 PM   #2
The Duck
Adult Content Provider
 
The Duck's Avatar
 
Industry Role:
Join Date: May 2005
Location: Europe
Posts: 18,243
Sweet, thanks!
__________________
Skype Horusmaia
ICQ 41555245
Email [email protected]
The Duck is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 02:38 PM   #3
jonnydoe
Confirmed User
 
jonnydoe's Avatar
 
Industry Role:
Join Date: Aug 2006
Location: USA
Posts: 543
I have been looking for exactly something like this...THX!
__________________
Want a Sponsor that really PAYS?!?!?!?!


I&C#Q 3-0/2 7+3.3 0=5|2
jonnydoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 02:44 PM   #4
alias
aliasx
 
alias's Avatar
 
Join Date: Apr 2001
Posts: 19,010
Cool script as usual, bump-o.
__________________
https://porncorporation.com
alias is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 02:45 PM   #5
Fenris Wolf
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
Fenris Wolf is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 02:56 PM   #6
CyberHustler
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.
CyberHustler is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 02:59 PM   #7
Jarmusch
 
 
Industry Role:
Join Date: May 2003
Posts: 12,464
Repped .
Jarmusch is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 05:14 PM   #8
Caligari
Confirmed User
 
Industry Role:
Join Date: Oct 2009
Location: At The Mountains Of Madness
Posts: 5,414
excellent script, thanks!
__________________
ATTN Webmasters Cruel Bucks - LIVE Gonzo Does Not Pay
------------------------------------------------
Animal Rescue Click Here to Feed An Animal for Free
Caligari is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 05:21 PM   #9
signupdamnit
Confirmed User
 
signupdamnit's Avatar
 
Industry Role:
Join Date: Aug 2007
Posts: 6,697
imaginary rep++
signupdamnit is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 09:09 PM   #10
epitome
So Fucking Lame
 
epitome's Avatar
 
Industry Role:
Join Date: Jun 2009
Location: St. Petersburg, FL
Posts: 12,158
Quote:
Originally Posted by NanoBot View Post
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.
At how many daily impressions does it become bloated and slow?

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.
epitome is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-17-2010, 09:25 PM   #11
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by epitome View Post
At how many daily impressions does it become bloated and slow?

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.
i actually built this because openx was bogging down and i really didn't need all the interface jazz, and i was only at like 100k imps. Another reason is openx has/had exploits and i just needed something simple i didn't need to monitor
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-09-2010, 07:22 AM   #12
TheSwed
Confirmed User
 
TheSwed's Avatar
 
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
TheSwed is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-09-2010, 07:37 AM   #13
pornguy
Too lazy to set a custom title
 
pornguy's Avatar
 
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!
pornguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-09-2010, 07:45 AM   #14
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
Quote:
Originally Posted by TheSwed View Post
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
it should work fine, as long as your banner urls are full urls
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-09-2010, 07:55 AM   #15
TheSwed
Confirmed User
 
TheSwed's Avatar
 
Join Date: Feb 2004
Location: Sweden.
Posts: 3,483
Quote:
Originally Posted by SmokeyTheBear View Post
it should work fine, as long as your banner urls are full urls
hmm..tried that but site2.com want to download javascript.php
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);
TheSwed is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
ad rotation, openx



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.