/    Sign up×
Community /Pin to ProfileBookmark

I want to know how am I do to make this script to support flash:, This is Php + Java…….

<?PHP
// Functions:

// Gives today’s date with no time
function todaysDate()
{
list($dd,$mm,$yyyy) = split(“-“,date(“d-m-Y”,time()));
return makeDateValue($dd,$mm,$yyyy);
}

function makeDateValue($dd,$mm,$yyyy)
{
return mktime(0, 0, 0, $mm, $dd, $yyyy);
}

?>
<SCRIPT LANGUAGE=”JavaScript”>
// Setup
var curAd;
var ads = new Array();
var delays = new Array();
var linx = new Array();
var external = new Array();
function displayAd()
{
var adLink = document.getElementById(“ADLINK”);
var ad = document.getElementById(“AD”);
if (ads.length)
{
ad.src = “./Ads/”+ads[curAd];
adLink.href=linx[curAd];
if (external[curAd])
{
adLink.target=”_blank”;
}
else
{
// It’s one of our own!
adLink.target=”_
self”;
}
if (ads.length > 1)
// Skip refresh if we only have 1 ad!
setTimeout(“displayAd()”,delays[curAd]*1000);
// Move on
curAd = (++curAd) % ads.length;
}
}
</SCRIPT>

<DIV align=center>
<A id=ADLINK href=”#”>
<IMG id=AD border=0 src=”#”>
</A>

<SCRIPT LANGUAGE=”JavaScript”>
// Setup
var i = 0;

// PHP generated JavaScript array:
<?php
$fd = fopen (“./Ads/ads.csv”, “r”);
if ($fd)
{
$adsUsed = 0;
$today = todaysDate();
$line = null;
while (!feof ($fd))
{
if (!$line)
{
// Skip header
$line = fgets($fd, 4096);
}
else
{
$line = fgets($fd, 4096);
if (strlen($line) > 10)
{
list($startDate,$durationMonths,$adDurationSecs,$pipeSeparatedImages,$URL) = split (“,”, $line, 5);
list($dd,$mm,$yyyy)= split (“/”, $startDate, 3);
$startDateTime = mktime(0, 0, 0, $mm, $dd, $yyyy);
$endDateTime = mktime(0, 0, 0, $mm + $durationMonths, $dd, $yyyy);
if ($durationMonths < 0 || ($durationMonths > 0 && ($startDateTime <= $today ) && ($today <= $endDateTime)))
{
// We’ve got a contender
++$adsUsed;
$image = split(“|“,$pipeSeparatedImages);
foreach($image as $anImage)
{
if (strtolower(substr($URL,0,7))==”http://”)
{
echo “external[i]=true;n”;
}
echo “ads[i] = “$anImage”;n”;
echo “linx[i] = “”.rtrim($URL).””;n”;
echo “delays[i++] = $adDurationSecs;n”;
}
}
}
}
}
fclose($fd);
}
?>
// Prevent same start ad being shown on every new page.. add random element
curAd = <?php echo rand(0,$adsUsed – 1); ?>;
displayAd();
</SCRIPT>
</DIV>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@fredmvFeb 23.2004 — [i]Originally posted by Rafael2004 [/i]

[B]I want to know how am I do to make this script to support flash[/B][/QUOTE]
Huh? ?
Copy linkTweet thisAlerts:
@Rafael2004authorFeb 24.2004 — ooops, sorry, bad writing jeje.....

I mean that script is Java+PHP, so is a banner rotation script, but it only shows images and I want to use swf files, How do I do that???

<?PHP

// Functions:

// Gives today's date with no time

function todaysDate()

{

list($dd,$mm,$yyyy) = split("-",date("d-m-Y",time()));

return makeDateValue($dd,$mm,$yyyy);

}

function makeDateValue($dd,$mm,$yyyy)

{

return mktime(0, 0, 0, $mm, $dd, $yyyy);

}


?>

<SCRIPT LANGUAGE="JavaScript">

// Setup

var curAd;

var ads = new Array();

var delays = new Array();

var linx = new Array();

var external = new Array();

function displayAd()

{

var adLink = document.getElementById("ADLINK");

var ad = document.getElementById("AD");

if (ads.length)

{

ad.src = "./Ads/"+ads[curAd];

adLink.href=linx[curAd];

if (external[curAd])

{

adLink.target="_blank";

}

else

{

// It's one of our own!

adLink.target="_
self";

}

if (ads.length > 1)

// Skip refresh if we only have 1 ad!

setTimeout("displayAd()",delays[curAd]*1000);

// Move on

curAd = (++curAd) % ads.length;

}

}

</SCRIPT>

<DIV align=center>

<A id=ADLINK href="#">

<IMG id=AD border=0 src="#">

</A>

<SCRIPT LANGUAGE="JavaScript">

// Setup

var i = 0;

// PHP generated JavaScript array:

<?php

$fd = fopen ("./Ads/ads.csv", "r");

if ($fd)

{

$adsUsed = 0;

$today = todaysDate();

$line = null;

while (!feof ($fd))

{

if (!$line)

{

// Skip header

$line = fgets($fd, 4096);

}

else

{

$line = fgets($fd, 4096);

if (strlen($line) > 10)

{

list($startDate,$durationMonths,$adDurationSecs,$pipeSeparatedImages,$URL) = split (",", $line, 5);

list($dd,$mm,$yyyy)= split ("/", $startDate, 3);

$startDateTime = mktime(0, 0, 0, $mm, $dd, $yyyy);

$endDateTime = mktime(0, 0, 0, $mm + $durationMonths, $dd, $yyyy);

if ($durationMonths < 0 || ($durationMonths > 0 && ($startDateTime <= $today ) && ($today <= $endDateTime)))

{

// We've got a contender

++$adsUsed;

$image = split("|",$pipeSeparatedImages);

foreach($image as $anImage)

{

if (strtolower(substr($URL,0,7))=="http://")

{

echo "external[i]=true;n";

}

echo "ads[i] = "$anImage";n";

echo "linx[i] = "".rtrim($URL)."";n";

echo "delays[i++] = $adDurationSecs;n";

}

}

}

}

}

fclose($fd);

}

?>

// Prevent same start ad being shown on every new page.. add random element

curAd = <?php echo rand(0,$adsUsed - 1); ?>;

displayAd();

</SCRIPT>

</DIV>





I thought changing these lines:

<DIV align=center>

<A id=ADLINK href="#">

<IMG id=AD border=0 src="#">

</A>



to this:



<DIV align=center>

<A id=ADLINK href="#">

<object classid="clsid?27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="32" height="32">

<param name="movie" value="3">

<param name="quality" value="high">

<embed src="3" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="32" height="32"></embed>

</object>

</A>



But it didnt work to me.... can anybody help me???
×

Success!

Help @Rafael2004 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...