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 Mark Forums Read
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 11-16-2010, 03:43 PM   #1
djroof
JuicyDevils.gr Owner
 
djroof's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: Greece
Posts: 25,392
Banner rotator...

any fast solution pls?
djroof is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 04:07 PM   #2
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,102
I have a fairly simple one I use across a bunch of my sites. Uses a 3 table database (banners, links, sites).

Pretty easy to modify out.

Database structure

--
-- Table structure for table `banners`
--

CREATE TABLE IF NOT EXISTS `banners` (
`id` int(10) NOT NULL auto_increment,
`site` int(10) NOT NULL default '0',
`name` varchar(254) NOT NULL,
`type` char(2) NOT NULL,
`width` int(10) NOT NULL default '0',
`height` int(10) NOT NULL default '0',
`last_used` datetime NOT NULL,
`active` tinyint(4) NOT NULL default '1',
PRIMARY KEY (`id`),
KEY `last_used` (`last_used`),
KEY `width` (`width`),
KEY `height` (`height`),
KEY `site` (`site`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1406 ;


-- --------------------------------------------------------

--
-- Table structure for table `links`
--

CREATE TABLE IF NOT EXISTS `links` (
`id` int(10) NOT NULL auto_increment,
`site` int(10) NOT NULL default '0',
`link` varchar(254) NOT NULL,
`active` tinyint(4) NOT NULL default '1',
PRIMARY KEY (`id`),
KEY `site` (`site`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 AUTO_INCREMENT=83 ;

-- --------------------------------------------------------

--
-- Table structure for table `sites`
--

CREATE TABLE IF NOT EXISTS `sites` (
`id` int(10) NOT NULL auto_increment,
`sponsor` int(10) NOT NULL default '0',
`name` varchar(35) NOT NULL,
`active` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id`),
KEY `sponsor` (`sponsor`)
) ENGINE=INNODB DEFAULT CHARSET=latin1 AUTO_INCREMENT=75 ;


Actual banner rotation code

// pass ins

// Type sc=softcore, hc=hardcore
// mxw maximum width in pixels
// mxh maximum height in pixels
// mnw minimum width in pixels
// mnh minimum height in pixels

function getad($type, $mxw, $mxh, $mnw, $mnh)
{
$adbhost = "localhost";
$adbuser = "dbusername";
$adbpass = "dbpassword";
$adb = mysql_connect($adbhost, $adbuser, $adbpass);


$sql_str="select a.id, a.name, c.name as sitename, a.height, a.width, b.link ";
$sql_str .="from banners a ";
$sql_str .="inner join links b on a.site=b.site ";
$sql_str .="inner join sites c on a.site=c.id ";
$sql_str .="where a.type='" . $type . "' ";
$sql_str .="and a.width<=" . $mxw . " and a.height<=" . $mxh . " and ";
$sql_str .="a.width>=" . $mnw . " and a.height>=" . $mnh . " ";
$sql_str .="order by a.last_used limit 1";
$result=mysql_query($sql_str,$adb);
if(!$result)
{
//echo "sql prob sql=" . $sql_str . "<br>\n";
}
else
{
$banner=mysql_fetch_array($result);
echo "<a href=" . $banner['link'] . " target=_blank>";
echo "<img src=http://www.yourdomainname.com/images/" . $banner['name'] . " border=0" . ' alt="' . $banner['sitename'] . '">';
echo "</a>";
}
$sql_str="update banners set last_used=now() where id=" . $banner['id'];
$result=mysql_query($sql_str,$adb);
}


How to call it in the page.


getad('sc',480,80,350,50);
__________________
All cookies cleared!

Last edited by sarettah; 11-16-2010 at 04:09 PM..
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 04:07 PM   #3
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
stick a load of banners in a directory and pull 1 at random?
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 04:08 PM   #4
Fabien
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 4,787
Cool thread, keep 'hem coming cause i wanna try a new one too.
Fabien is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 04:12 PM   #5
djroof
JuicyDevils.gr Owner
 
djroof's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: Greece
Posts: 25,392
thanks!!!!!
djroof is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 04:13 PM   #6
Adraco
Confirmed User
 
Adraco's Avatar
 
Industry Role:
Join Date: May 2009
Location: Onboard an airplane around the globe
Posts: 3,735
Smart Spots from Smart-Scripts.com?
__________________
----------------------------------------------------------------------------------
The truth is not affected by the beliefs, or doubts, of the majority.
Adraco is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 04:14 PM   #7
atom
Confirmed User
 
atom's Avatar
 
Join Date: Apr 2002
Location: Minneapolis
Posts: 2,740
http://www.openx.org/
__________________
Have Chargebacks? Send me a message.

ChargebackHelp.com
atom is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 04:16 PM   #8
Jdoughs
Confirmed User
 
Jdoughs's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Great White North
Posts: 5,794
PHP Code:
<?php
$ad
[] = "<a href=''><img src='' alt='' width='' height='' /></a>";
$ad[] = "<a href=''><img src='' alt='' width='' height='' /></a>";
$ad[] = "<a href=''><img src='' alt='' width='' height='' /></a>";
$ad[] = "<a href=''><img src='' alt='' width='' height='' /></a>";
shuffle($ad);
echo 
$ad[0]; 
?>
__________________
LinkSpun - Premier Adult Link Trading Community - ICQ - 464/\281/\250
Be Seen By New Webmasters/Affiliates * Target out webmasters/affiliates based on niches your sites are for less than $20 a month.
AmeriNOC - Proudly hosted @ AmeriNOC!
Jdoughs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 04:43 PM   #9
Vendzilla
Biker Gnome
 
Vendzilla's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: cell#324
Posts: 23,200
http://dynamicdrive.com
__________________
Carbon is not the problem, it makes up 0.041% of our atmosphere , 95% of that is from Volcanos and decomposing plants and stuff. So people in the US are responsible for 13% of the carbon in the atmosphere which 95% is not from Humans, like cars and trucks and stuff and they want to spend trillions to fix it while Solar Panel plants are powered by coal plants
think about that
Vendzilla is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 04:46 PM   #10
wehateporn
Promoting Debate on GFY
 
wehateporn's Avatar
 
Industry Role:
Join Date: Apr 2007
Posts: 27,173
This is one of the most basic and user friendly HTML rotators ever, it's free as well

http://www.focalmedia.net/htmlrotate.html
__________________
wehateporn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 05:26 PM   #11
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,102
Fuck. When I was sanitizing the code I some how killed a couple of things.

Need a select to the database, or in the sql the database could be specified.

Also there are a couple of other things that should be in there to protect it a touch.

Sorry about that.

a better version of the actual script portion:

Code:
// pass ins
// Type  sc=softcore, hc=hardcore
// mxw maximum width in pixels
// mxh maximum height in pixels
// mnw minimum width in pixels
// mnh minimum height in pixels
function getad($type, $mxw, $mxh, $mnw, $mnh)
{
  // default to softcore if not provided or if invalid
  if($type<>'sc' && $type<>'hc')
  {
    $type='sc';
  }
  
  // check for numeric values in banner dimensions
  // protects against sql injection too
  if(is_numeric($mxw) && is_numeric($mxh) && is_numeric($mnw) && is_numeric($mnh))
  {
    // connection could be a pass in
    // doing it here is for stand alone
    // usually would be in an included function
     
    $adbhost = "localhost";
    $adbuser = "dbusername";
    $adbpass = "dbpassword";
    $adbname = "dbname";
    $adb = mysql_connect($adbhost, $adbuser, $adbpass);
    if($adb)
    {
      // select to the database
      mysql_select_db($adbname,$adb);
      
      // sql to pull the banner
      $sql_str="select a.id, a.name, c.name as sitename, a.height, a.width, b.link ";
      $sql_str .="from banners a ";
      $sql_str .="inner join links b on a.site=b.site ";
      $sql_str .="inner join sites c on a.site=c.id ";
      $sql_str .="where a.type='" . $type . "' ";
      $sql_str .="and a.width<=" . $mxw . " and a.height<=" . $mxh . " and ";
      $sql_str .="a.width>=" . $mnw . " and a.height>=" . $mnh . " ";
      $sql_str .="order by a.last_used limit 1";
      $result=mysql_query($sql_str,$adb);
      if(!$result)
      {
        //echo "sql prob sql=" . $sql_str . "<br>\n";
      }
      else
      {
        //only attempt to present the banner if evrything went ok 
        if(mysql_num_rows($result)>0)
        {
          $banner=mysql_fetch_array($result);
          echo "<a href=" . $banner['link'] . " target=_blank>";
          echo "<img src=http://www.yourdomainname.com/images/" . $banner['name'] . " border=0" . ' alt="' . $banner['sitename'] . '">';
          echo "</a>";     
          $sql_str="update banners set last_used=now() where id=" . $banner['id'];
          $result=mysql_query($sql_str,$adb);
        }
        else
        {
          // could do a default banner here
        }
      }
    }
  }
}
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2010, 05:57 PM   #12
ruff
I have a plan B
 
ruff's Avatar
 
Industry Role:
Join Date: Aug 2004
Location: Seattle - Miami - St Kitts
Posts: 5,501
Someone posted this Simple Banner Rotator on another thread and I've using it. It's pretty easy to set up and works real well.

http://www.spyka.net/scripts/javascr...banner-rotator
__________________
CryptoFeeds
ruff is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-17-2010, 08:53 AM   #13
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
i made/posted this not long ago

https://gfy.com/fucking-around-and-business-discussion/992905-simple-smart-banner-rotation-tutorial-ghetto-openx.html
__________________
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-17-2010, 09:05 AM   #14
Twoface31
Confirmed User
 
Twoface31's Avatar
 
Join Date: Sep 2006
Posts: 2,746
this is cool ;)
__________________

Email: [email protected]
HentaiG4h * Lusty Life
ICQ: 291-953
Twoface31 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-17-2010, 09:17 AM   #15
SuzzyQ
Confirmed User
 
SuzzyQ's Avatar
 
Industry Role:
Join Date: Dec 2006
Location: Along the shore.
Posts: 1,557
Quote:
Originally Posted by wehateporn View Post
This is one of the most basic and user friendly HTML rotators ever, it's free as well

http://www.focalmedia.net/htmlrotate.html
I use this one on a mainstream site and it works well.
SuzzyQ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-17-2010, 09:31 AM   #16
Emil
Confirmed User
 
Emil's Avatar
 
Join Date: Feb 2007
Location: Sweden
Posts: 5,650
PHP Code:
<?php
srand 
((double)microtime()*1000000);
$f_contents file ("banners.txt");
$line $f_contents[array_rand ($f_contents)];
print 
$line;
?>
Make banners.txt. One line of HTML for the banner on each line.
__________________
Free 🅑🅘🅣🅒🅞🅘🅝🅢 Every Hour (Yes, really. Free ₿itCoins.)
(Signup with ONLY your Email and Password. You can also refer people and get even more.)
Emil is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-17-2010, 09:46 AM   #17
HomerSimpson
Too lazy to set a custom title
 
HomerSimpson's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: Springfield
Posts: 13,826
small - javascript

big - php (+mysql) custom

huge - openx


if you need any extra help
http://www.awmzone.com/services
__________________
Make a bank with Chaturbate - the best selling webcam program
Ads that can't be block with AdBlockers !!! /// Best paying popup program (Bitcoin payouts) !!!

PHP, MySql, Smarty, CodeIgniter, Laravel, WordPress, NATS... fixing stuff, server migrations & optimizations... My ICQ: 27429884 | Email:
HomerSimpson is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-17-2010, 11:04 AM   #18
IllTestYourGirls
Ah My Balls
 
IllTestYourGirls's Avatar
 
Industry Role:
Join Date: Feb 2007
Location: Under the gold leaf ICQ 388-454-421
Posts: 14,311
Funny I was just looking for one yesterday as well!

Quote:
Originally Posted by Jdoughs View Post
PHP Code:
<?php
$ad
[] = "<a href=''><img src='' alt='' width='' height='' /></a>";
$ad[] = "<a href=''><img src='' alt='' width='' height='' /></a>";
$ad[] = "<a href=''><img src='' alt='' width='' height='' /></a>";
$ad[] = "<a href=''><img src='' alt='' width='' height='' /></a>";
shuffle($ad);
echo 
$ad[0]; 
?>
Will this pull them at random? I want them to be different each surfer that comes.
__________________
IllTestYourGirls 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
Thread Tools



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.