 |
Results from the most recent live auction are here.
17 members in the live chat room. Join Chat!
| |
04-05-2006, 01:50 AM
|
· #1 | | Steven Name: Steven Gibbons Location: United Kindom Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 ( Donate)
| Random add Script Hi,
If you want a copy its nice and easy in php, just put where you want the ads to appear: Code:
<?php
srand( microtime() * 1000000);
$advertise = rand(1,3);
//After the rand decided how many youve got and the first and last number e.g got 3, 1,3
switch($advertise)
//you can add more just use the same format
{
case 1 : $banner="site 1 image url"; $url="site one address"; break;
case 2 : $banner="site 2 image url"; $url="site two address"; break;
case 3 : $banner="site 3 image url"; $url="site 3 address"; break;
}
$display = "<a href=\"$url\" target=\"_blank\"> ";
$display.= "<img src=\"$banner\" ";
$display.= "width=\"468\" height=\"60\" border=\"0\" >";
$display.="</a>";
echo($display);
?>
Thanks and enjoy.
p.s (I Like rep  ) |
| |
04-05-2006, 05:49 PM
|
· #2 | | DNOA Member Location: Milford MA Join Date: Oct 2005
Posts: 682
NP$: 94.45 ( Donate)
| And if you want FlatDB, I just wrote this.
In your DB file, put: Code: http://www.hi.com||http://www.hi.com/hi.png
http://www.hi2.com||http://www.hi2.com/hi.png
The php: PHP Code: <?
funtion ad_template($url, $img){
$ad = "<a href='".$url."'><img src='".$img."' alt=''/>";
return $ad;
}
$i = 0;
$lines = file('addb.txt');
foreach($lines as $line){
$i++;
$data = explode("||", $line);
$return[$i] = ad_template($data[0], $data[1]);
}
$number = rand(0,$i);
echo $return[$number];
?> |
| |
04-15-2006, 01:31 PM
|
· #3 | | Resistance is Futile Name: Mitchell Location: Calgary, Canada Join Date: Apr 2006
Posts: 1,063
NP$: 156.05 ( Donate)
| That's a pretty useful script, I'll use it everywhere!
Added Random Ad Sizes. PHP Code: <?php
srand( microtime() * 1000000);
$advertise = rand(1,3);
//After the rand decided how many youve got and the first and last number e.g got 3, 1,3
switch($advertise)
//you can add more just use the same format
{
case 1 : $banner="site 1 image url"; $url="site one address"; $imgwidth="88"; $imgheight="31"; break;
case 2 : $banner="site 2 image url"; $url="site two address"; $imgwidth="50"; $imgheight="50"; break;
case 3 : $banner="site 3 image url"; $url="site 3 address"; $imgwidth="468"; $imgheight="60"; break;
}
$display = "<a href=\"$url\" target=\"_blank\"> ";
$display.= "<img src=\"$banner\" ";
$display.= "width=\"$imgwidth\" height=\"$imgheight\" border=\"0\" >";
$display.="</a>";
echo($display);
?>
Last edited by Borghunter : 04-15-2006 at 01:47 PM.
|
| |
04-15-2006, 10:46 PM
|
· #4 | | Steven Name: Steven Gibbons Location: United Kindom Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 ( Donate)
| I could have added the sizes, ill do that on the next version that comes, out, cvxdes, i dont see what you are trying to do, break into my thread, mine is just a flat db, no mysql or anything involved. |
| |
04-15-2006, 10:55 PM
|
· #5 | | www.1weblord.com Name: William R. Nabaza - williamrnabaza.com Location: Philippines - www.Nabaza.com Join Date: Dec 2005
Posts: 16,738
NP$: 18587.23 ( Donate)
| nice script, rep is coming your way. |
| |
04-15-2006, 11:11 PM
|
· #6 | | Steven Name: Steven Gibbons Location: United Kindom Join Date: Aug 2005
Posts: 1,506
NP$: 40.00 ( Donate)
| Oh, thanks! Its a script i needed to do something then when i learnt php, everyone is liking it. |
| |
06-21-2006, 01:18 PM
|
· #7 | | NP Maniac™ Name: Tom Join Date: Apr 2004
Posts: 627
NP$: 21.75 ( Donate)
| Very nice, was looking for something like this a while ago  ..!
__________________
~ Thomas Cameron
|
| |
08-24-2006, 01:20 PM
|
· #8 | Join Date: Jul 2006
Posts: 3,290
NP$: 252.35 ( Donate)
| Simply basic but applicable to any object with modifications. Thanks. 
__________________ LLLL.coms: ALL 2 Premium Letters + U + K  |
| |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |