Note: The rotsig.php file in the zip is the actual file to edit and access to show the signature rotation. The rotsigs.php file is a utillity file which is needed to make rotsig.php work. You can have multiple copies of rotsig.php in the same directory using the same copy of rotsigs.php. clear.gif is displayed if you do not have any images setup for the forum accessing the script. Also, the images to be rotated need to be on the same server as the rotsig.php script, prefferably in the same directory.
I was bored yesterday, so I whipped up this PHP script that makes it easy to create a rotating signature. You need two things to use this script: a server with PHP support (no MySQL needed), and be able to convert hexadecimal to binary and back.
The first thing to do is to download the zip I attached and open up the rotsig.php file. It'll look like this:
PHP Code:
<?php
//set this to a different value for each rotating signature
$scriptid='rotsig';
require('rotsigs.php');
//Decide which forum this is
//first param is a mask to use, second param is string to find in the URL of the requester
//0x0001 is the default mask. If any bits in the forum mask match bits in the image mask,
// the image will be used in the circulation while being viewed from that location.
//==== START OF FORUM LIST
checkforum(0x0002,'zelaron.com');
checkforum(0x0004,'vbulletin.com');
checkforum(0x0004,'vbulletin.org');
checkforum(0x0008,'tournament.com');
//==== END OF FORUM LIST
while($done==0){
switch($rotsig){
//The case numbers must be continuous and in order. The first param is the image mask
// the second param is the file to use. The third, option param is the file type. The
// default is 'image/gif'
//==== START OF IMAGE LIST
case 0:checkrules(0x000F,'./wwusigsmall.gif');
case 1:checkrules(0x000B,'./wwusig.gif');
case 2:checkrules(0x000B,'./wwusig2.gif');
case 3:checkrules(0x0003,'./wwuceiling.jpg','image/jpeg');
//==== END OF IMAGE LIST
default:
if($done==0){
if($rotsig==0){
//if it appears that there are no sigs, give up
sendheaders();
readfile("./clear.gif");
$done=1;
}else{//($rotsig==0)
//wrap arround
$rotsig=0;
$nextsig=1;
}//endif($rotsig==0)
}//endif($done==0)
}//endswitch($rotsig)
}//endwhile($done==0)
?>
|
The first thing to do is to change the script id
Replace rotsig with some personal identifier. This way, this script won't interfere with the operation of possible other copies of the same script on the same server.
Next, we're going to set up the forum masks.
Code:
checkforum(0x0002,'zelaron.com');
checkforum(0x0004,'vbulletin.com');
checkforum(0x0004,'vbulletin.org');
checkforum(0x0008,'tournament.com'); |
What this is is a way to use the same signature rotation for all the forums you visit, yet remove certain signatures that might break individual forums' rules from being displayed on those forums. If you don't want to mess with this, just delete all the checkforum lines. Otherwise, replace the domains I have with your own domains and give each domain a unique power of 2 starting with 2 (the numbers are in hexidecimal). Add or remove entries as needed. If you visit multiple forums with the same conditions, you can give them the same number, as I did for vbulletin.com and vbulletin.org above.
Now is the main part: The image list.
Code:
case 0:checkrules(0x000F,'./wwusigsmall.gif');
case 1:checkrules(0x000B,'./wwusig.gif');
case 2:checkrules(0x000B,'./wwusig2.gif');
case 3:checkrules(0x0003,'./wwuceiling.jpg','image/jpeg'); |
This is where you setup what images are included in the rotation. Each line needs to have its own case number, and the numbers need to be sequential (no gaps). The number after "checkrules(" is the mask that sets which forums to display the sig in. If you didn't set that up in the first part, just set this number to 0x0001 for everything, otherwise, setting (making the bit 1) the lowest bit (0x0001) will make the image show for forums you didn't list, setting the bit for each forum you listed will enable the image for that forum. The part after the number is the path of the image on the server. You can put another part after the file name to indicate the type of image; by default, this is 'image/gif'. You can have as many or as few of these checkrules lines as you need.
After you finish setting up the rotsig.php file, you can rename it if you like, then upload it, rotsigs.php, and clear.gif to the same directory on your server. Putting your rotsig.php file in an image tag will display the first signature in your rotation. Each time you refresh the page, it will show the next image.
======Advanced======
You can confuse bulletin board systems and people by giving your rotsig.php script a .gif extention if you use an Apache web server. Simply rename the script to a file name ending with .gif, then add lines similar to these to the .htaccess file for the directory you put the script in:
Code:
<Files rotsig.gif>
ForceType application/x-httpd-php
</Files> |