Sig rotation from array of URLs?

Soldato
Joined
26 Aug 2006
Posts
9,726
Location
62.156684,-49.781113
I'm feeling creative today, and I've got nothing else to do except watch Soccer Special and sit on my computer.

All the sig rotation scripts I've found rely on the files being in a directory...

So:

1. How much bandwidth does this take up on this forum in an average month?
2. Is it possible to have a PHP choosing from a list of URLs, so I can use PhotoBucket's bandwidth, not my own?
 
PHP:
<?php

//image array redirect thing made just for gumbald because he's special. I even tested it for him.
$arr[1]="http://www.imgplace.com/directory/dir805/1187440762.jpg";
$arr[2]="http://www.imgplace.com/directory/dir805/1187440777.jpg";
$arr[3]="http://www.imgplace.com/directory/dir805/1187440801.gif";

//do random numberage
srand((double) microtime( )*1000000);
$rand=rand(1,count($arr));

//set header so browsers don't (well, shouldn't) cache it
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Fri, 17 Aug 2007 05:00:00 GMT");

//set the location for the browser to load
header('Location: '.$arr[$rand]);

?>

I've never made one of those before, but there ya go! :) Not too tricky if you have a good idea of how it works anyway :p You can add as much to the array as you like.
 
furnace said:
*code*

I've never made one of those before, but there ya go! :) Not too tricky if you have a good idea of how it works anyway :p You can add as much to the array as you like.

Awesome, thanks :)

Figured it would be simple enough, I've not quite got the knowledge of PHP yet to just write something out yet, that would have taken me a while...

And I can just point my sig to a '.php' file?
 
Yeah, just stick that code in whatever.php

It seems to fluff up the randomness every now and then but that might change once you have it loaded into your sig.

Plus I don't want to spend my Saturday afternoon playing with a random sig script :p (I'm busy getting Mondays work done so I can go out with mates on Wednesday :D)

edit;

Regarding php knowledge - try and make things youself and google for specific problems.

For example, I wanted to make sure I had the location header correct, so instead of googling "Random Image Script", I did all of it then googled "php header location" to make sure I'd got that bit right.

Otherwise you can end up relying on tutorials too much... but if you do things this way, I think you'll end up writing whole chunks of php without looking at tutorials. And you won't even realise how much you've learnt - until one day you make something awesome and think "woah, I made that!" :D
 
Last edited:
I've realised how simple it is now...

All of my PHP so far has come from having to work out how to do things once I'd hit a problem, rather than setting out to write something, I think that's the difference.

I should set myself more challenges :) I'm new to all the web stuff, hence the uncertainty. All my degree programming has been non-useful and in obscure languages :p

EDIT: with all this website talk in the two threads, where's your personal empire? :)
 
Last edited:
gumbald said:
EDIT: with all this website talk in the two threads, where's your personal empire? :)
It got taken offline, currently making a new one but I don't have time - with my forum addiction and "real" work to do... lol.

btw I'm never visiting your myspace page again... ever... :( evil!
 
Last edited:
I think the rotation is active :)

And messenger is still messing about, I'm gonna go onto my laptop soon...
 
Back
Top Bottom