View Full Version : Signature Rotation/Randomization
Boomer
2006-02-28, 12:37 AM
Well, i've been cranking out some signatures I want to use, but I want to use more than one. I remember a post from way back when that dealt with a website that offered a service, where you could upload 5-6 Signatures, and it would give you the vBcode. Then, when used on a vBcode forum, the signature would be randomized every time the page was loaded.
Since the search function failed, and google confused me, I was wondering if anyone knew of something like this that doesn't involve HTML, or really much coding at all, for the simple-minded fool such as myself?
I know this will come in handy for other people too, so i'm posting it in The Lounge.
Thanks in advance!
Hamma
2006-02-28, 08:25 AM
The only way I personally know if is creating a blank index.php and inserting the following text:
<?php
// mt_rand wrapper, seeds automatically, once per page
function rnd($min, $max) {
global $rnd_seeded;
if ($rnd_seeded!=1) {
$mtime=microtime();
list($usec,$sec)=explode(" ",$mtime);
mt_srand($usec*$sec);
$rnd_seeded=1;
}
return mt_rand($min, $max);
}
// read folder
$folder=opendir(".");
while ($file = readdir($folder)){
$ext=strtolower(substr(trim($file),-4));
if ($ext==".jpg"||$ext==".gif"||$ext=="jpeg"||$ext==".png")$imgs[]=$file;
}
closedir($folder);
// image chosen
$img_chosen = $imgs[rnd(0, count($imgs)-1)];
// send output
if (is_array($imgs)) {
header ("location: $img_chosen");
} else {
header ("location: http://www.google.com");
}
?>
Put the index.php and all your signature files into a folder called sig.gif or sig.jpg and link to the folder as if it was an image.
Lartnev
2006-02-28, 02:36 PM
Those syntax highlighting colours are the work of the devil :evil:
Boomer
2006-02-28, 05:12 PM
How do I create a blank php doc?
Boomer
2006-02-28, 05:36 PM
Is that just the name of the file? (index.php)? Also, where do I insert the location of my signatures?
Sorry, i'm trying to figure it out.
1. Copy and paste that all that into notepad and save the file as "index.php".
2. Make a folder on your webserver called "sigs.gif"
3. Put the "index.php" file along with all the signature images you want into the "sigs.gif" folder.
4. Link your signature as {img}http://www.yourwebsite.com/sigs.gif{/img}
{ = [
Hamma
2006-03-01, 11:47 AM
Yep exactly as 321 explains - you don't need to define the folder in the PHP it's just a copy paste.
Firefly
2006-03-01, 02:23 PM
I use the "rotator.php" trick to rotate through each of my fifty signatures on other forums. I can send you the file, Boomer, if you so desire.
Boomer
2006-03-01, 04:46 PM
Thank you, fellas. I'll get it worked out soon enough. Thanks 321 for explaining it, and firefly, I think the randomizer will do just fine. : )
Hope this helps other people as well.
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.