eMoneySpace
Welcome, Guest. Please login or register.
Did you miss your activation email?
News: Welcome to eMoneySpace! Jan 30, 2023 04:28 pm




Banner Rotation PHP Code?
Print
Author Topic: Banner Rotation PHP Code?  (Read 1536 times)
yd-ptc

Reputation: (0)
*

Offline

Gender: Male
Posts: 421
Referrals: 1

View Profile WWW
Jan 07, 2010 07:31 am

Does anyone have a Banner Rotation PHP Code?
Logged
Delusional

Reputation: (+2)
*

Offline

Gender: Male
Posts: 4713
Referrals: 6


GPSBlack Creator

View Profile WWW
Reply #1: Jan 07, 2010 09:41 am

there is one in cpanel, there is one in aurora. also check google i bet you will find about 150k of them.
Logged

KidRock
Reputation: (+5)
*

Offline

Posts: 836
Referrals: 1


View Profile WWW
Reply #2: Jan 07, 2010 10:22 am

Here u got Smiley


Quote
<center><script language="Javascript">
<!--
// Create arrays to contain all the values
// for links and image locations
link = new Array
image = new Array

link[1]=""
image[1]=""

link[2]=""
image[2]=""

link[3]=""
image[3]=""

link[4]=""
image[4]=""

link[5]=""
image[5]=""

link[6]=""
image[6]=""

link[7]=""
image[7]=""

link[8]=""
image[8]=""

link[9]=""
image[9]=""

// Create a random number between 1 and last number
random_num = (Math.round((Math.random()*Cool+1))
// Write a link and images with random array
document.write('<a href="' + link[random_num] + '" target="_blank">');
document.write('<img src="' + image[random_num] + '" border="0"></a>');
-->
</script>
</center>

codes need to be like this :

Quote
Logged

Delusional

Reputation: (+2)
*

Offline

Gender: Male
Posts: 4713
Referrals: 6


GPSBlack Creator

View Profile WWW
Reply #3: Jan 07, 2010 12:15 pm

he said PHP not javascript. Please pay attention to what the requesting poster wants.
Logged

yd-ptc

Reputation: (0)
*

Offline

Gender: Male
Posts: 421
Referrals: 1

View Profile WWW
Reply #4: Jan 08, 2010 08:52 am

there is one in cpanel, there is one in aurora. also check google i bet you will find about 150k of them.
k ill c the cpanle 1
Logged
nitinkumar
Reputation: (+33)
*

Offline

Posts: 4103
Referrals: 3


Owner of alwaysbux.com

View Profile WWW
Reply #5: Jan 08, 2010 12:36 pm

Here is simple one

<?php

$num = Rand (1,2);

switch ($num)
{
case 1:
echo '<a href="site url"><img src="banner url"></a>';
break;
case 2:
echo '<a href="site url"><img src="banner url"></a>';
}

?>


Logged

Delusional

Reputation: (+2)
*

Offline

Gender: Male
Posts: 4713
Referrals: 6


GPSBlack Creator

View Profile WWW
Reply #6: Jan 08, 2010 12:43 pm

there is a code bbcode for showing coding....please use it.

btw yours is the same as the one above, both use hard coded arrays....must i do everything?

banclick.php
Code:
<?php
session_start
();

$q=mysql_query("SELECT * FROM banners WHERE bMAXCLICKS>bCLICKS AND bACTIVE=1 AND bID=".$_GET['ID'].");
if(mysql_num_rows(
$q) == 0)
{ die("
Advert doesn't exist."); }
$r=mysql_fetch_array($q);
if($_SESSION['
adclick'] == 0) {
query("UPDATE banners SET bCLICKS=bCLICKS+'
1' WHERE bID='{$_GET['ID']}'");
$_SESSION['
adclick']=$_GET['ID'];
}
header("Location:".$r['
bURL']);
?>

display banners
Code:
<?php
$q
=mysql_query("SELECT * FROM banners WHERE bMAXCLICKS>bCLICKS AND bACTIVE=1 ORDER BY rand() LIMIT 1");
if(
mysql_num_rows($q))
{
$r=mysql_fetch_array($q);
query("UPDATE banners SET bVIEWS=bVIEWS+'1' WHERE bID={$r['bID']}");
print 
"<center><table width='468'>
<tr>
<td><a href='banclick.php?ID=
{$r['bID']}' border='0'>
<div align='center'>
<img width='468' height='60' src='
{$r['bIMAGE']}' border='0'>
</div>
</a></td>
</tr>
</table>
</center>"
;
}
?>


SQL for banner table
Code:
DROP TABLE IF EXISTS `banners`;
CREATE TABLE `banners` (
  `bID` int(11) NOT NULL auto_increment,
  `bURL` varchar(255) NOT NULL default '',
  `bIMAGE` varchar(255) NOT NULL default '',
  `bACTIVE` int(11) NOT NULL default '0',
  `bCLICKS` int(11) NOT NULL default '0',
  `bVIEWS` int(11) NOT NULL default '0',
  `bMAXCLICKS` int(11) NOT NULL default '0',
  `bFROM` int(11) NOT NULL default '0',
  PRIMARY KEY  (`bID`)
) TYPE=MyISAM  AUTO_INCREMENT=1 ;
« Last Edit: Jan 08, 2010 01:00 pm by Delusional » Logged

yd-ptc

Reputation: (0)
*

Offline

Gender: Male
Posts: 421
Referrals: 1

View Profile WWW
Reply #7: Jan 09, 2010 04:19 am

thanx
Logged
Print
 
Jump to:  
Copyright © 2008-2023 eMoneySpace. All rights reserved.