Jul 27, 2008

Yet Another Signature Rotator - (Easier, and more Efficient)

Free Web Hosting, No Ads > CONTRIBUTE > Tutorials

free web hosting

Yet Another Signature Rotator - (Easier, and more Efficient)

thablkpanda
Hey Trap, It's Mr. Panda, and I'm introducing a signature rotator script I came across several months ago. Unlike most other signature rotators on trap17, this one does DOES NOT require the configuration process, and a new signature can be added, simply by uploading it to the proper directory. Seeing as this requires so much less configuration, I do hope it will be implemented by some of you 'Sig Masters' out there biggrin.gif, that have to add another line of code to your rotator file each time you want to add a new sig. This simplifies the process greatly. Enough chit-chat. Let's get this one-time install over with biggrin.gif -

Necessary stuff -
1. Host supporting PHP (required) ,.htaccess,(optional) and CHMOD (optional) (Trap17 does)
2. More than one signature file to rotate
3. Plain-Text editor, or specialized PHP Editor (PHP Designer 2005, Notepad, etc.)
4. FTP Client

Procedure -

Step 1
Create a new .php file, named 'index.php' (no quotes). Copy and Paste the following code into that PHP file, and save and close.

CODE

<?php

/*

AUTOMATIC IMAGE ROTATOR
Version 2.2 - December 4, 2003
Copyright (c) 2002-2003 Dan P. Benjamin, Automatic, Ltd.
All Rights Reserved.

http://www.hiveware.com/imagerotator.php

http://www.automaticlabs.com/


DISCLAIMER
Automatic, Ltd. makes no representations or warranties about
the suitability of the software, either express or
implied, including but not limited to the implied
warranties of merchantability, fitness for a particular
purpose, or non-infringement. Dan P. Benjamin and Automatic, Ltd.
shall not be liable for any damages suffered by licensee
as a result of using, modifying or distributing this
software or its derivatives.


ABOUT
This PHP script will randomly select an image file from a
folder of images on your webserver.  You can then link to it
as you would any standard image file and you'll see a random
image each time you reload.

When you want to add or remove images from the rotation-pool,
just add or remove them from the image rotation folder.


VERSION CHANGES
Version 1.0
 - Release version

Version 1.5
 - Tweaked a few boring bugs

Version 2.0
 - Complete rewrite from the ground-up
 - Made it clearer where to make modifications
 - Made it easier to specify/change the rotation-folder
 - Made it easier to specify/change supported image types
 - Wrote better instructions and info (you're them reading now)
 - Significant speed improvements
 - More error checking
 - Cleaner code (albeit more PHP-specific)
 - Better/faster random number generation and file-type parsing
 - Added a feature where the image to display can be specified
 - Added a cool feature where, if an error occurs (such as no
   images being found in the specified folder) *and* you're
   lucky enough to have the GD libraries compiled into PHP on
   your webserver, we generate a replacement "error image" on
   the fly.

   Version 2.1
       - Updated a potential security flaw when value-matching
         filenames

   Version 2.2
       - Updated a few more potential security issues
       - Optimized the code a bit.
       - Expanded the doc for adding new mime/image types.

       Thanks to faithful ALA reader Justin Greer for
       lots of good tips and solid code contribution!


*/




/* ------------------------- -----------------------


Set $folder to the full path to the location of your images.
For example: $folder = '/user/me/example.com/images/';
If the rotate.php file will be in the same folder as your
images then you should leave it set to $folder = '.';

*/


$folder = '.';


/*

   If you'd like to enable additional image types other than
gif, jpg, and png, add a duplicate line to the section below
for the new image type.

Add the new file-type, single-quoted, inside brackets.

Add the mime-type to be sent to the browser, also single-quoted,
after the equal sign.

For example:

PDF Files:

 $extList['pdf'] = 'application/pdf';

   CSS Files:

       $extList['css'] = 'text/css';

   You can even serve up random HTML files:

    $extList['html'] = 'text/html';
    $extList['htm'] = 'text/html';

   Just be sure your mime-type definition is correct!

*/

   $extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpeg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';


// You don't need to edit anything after this point.


// --------------------- END CONFIGURATION -----------------------

$img = null;

if (substr($folder,-1) != '/') {
$folder = $folder.'/';
}

if (isset($_GET['img'])) {
$imageInfo = pathinfo($_GET['img']);
if (
    isset( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&
       file_exists( $folder.$imageInfo['basename'] )
   ) {
 $img = $folder.$imageInfo['basename'];
}
} else {
$fileList = array();
$handle = opendir($folder);
while ( false !== ( $file = readdir($handle) ) ) {
 $file_info = pathinfo($file);
 if (
     isset( $extList[ strtolower( $file_info['extension'] ) ] )
 ) {
  $fileList[] = $file;
 }
}
closedir($handle);

if (count($fileList) > 0) {
 $imageNumber = time() % count($fileList);
 $img = $folder.$fileList[$imageNumber];
}
}

if ($img!=null) {
$imageInfo = pathinfo($img);
$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
header ($contentType);
readfile($img);
} else {
if ( function_exists('imagecreate') ) {
 header ("Content-type: image/png");
 $im = @imagecreate (100, 100)
     or die ("Cannot initialize new GD image stream");
 $background_color = imagecolorallocate ($im, 255, 255, 255);
 $text_color = imagecolorallocate ($im, 0,0,0);
 imagestring ($im, 2, 5, 5,  "IMAGE ERROR", $text_color);
 imagepng ($im);
 imagedestroy($im);
}
}

?>


Make sure you saved, and closed biggrin.gif..

Step 2

Open a FTP Client, I'm using FlashFXP, and login to your FTP site...
user posted image
In the public_html directory, create a new folder called "sig.png" (without quotes). Into this folder, upload the index.php file, along with more than one signature you want to rotate.

user posted image
The Index.php file is highlighted.. the rest are my signatures, and a .htaccess file that will be described later

Finally, open your favorite browser (Should be Firefox) and visit http://www.yoursite.com/sig.png. (where yoursite.com is the root directory for wherever you're hosted).

You should see one of your signatures, if not, check the Troubleshooting section. Refresh the page, and you should see another one of your sigs. Again, if not, see the Troubleshooting Section..

Of course, you'll replace your current signature with this by adding the following string into your signature block -

CODE
[IMG]http://www.yoursite.com/sig.png[/IMG]


Advanced Features/Suggestions

If you'd like for only a certian signature to be shown in that directory, query it the following way...

CODE
http://example.com/rotate.php?img=mikescreation.jpg


Where 'mikescreation.jpg' is the signature's filename in the sig.png directory that you wish to show specifically.

---

Wish to randomly select OTHER types of files, opposed to just images?

Open up index.php and look for this block of code -

CODE


   $extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpeg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';


To that list you'll add the MIME types of the other filetypes you wish to randomize in that folder. Save and upload, and you can randomize any other files you want. There are simplified instructions for that configuration above that block of code, courtesy of Dan P. Benjamin, the script's writer.

Troubleshooting

Question : Instead of getting my signature, when I visit my sig.png directory, I see a list of those signatures in that directory.

Answer : Upload the following file, named '.htaccess' to your sig.png directory. The problem is a result of a indexing error, which is fixable by this line of code -

CODE

DirectoryIndex index.php


Save and close that file, as '.htaccess'. Nothing more. And upload it to the proper directory. Your signatures will randomize now.

Closing

In conclusion, any further questions will be answered promptly in this thread, I HAVE turned on E-mail notification.

Also, This script was NOT written by me, It was created by Dan P. Benjamin, whose contact information you will find at the top of the index.php file. To reiterate, I did NOT write this script, I wrote the tutorial.

Thanks for reading, happy Sigging (sp? biggrin.gif)

- Mr. Panda

 

 

 


Reply

bluhapp
great.. this tutorial is more detail. the previous tutorial is not as detail as this one

Reply

Saint_Michael
well the thing with that scripts its going ot cost you alot of webspace to use unlike the other ones but this owuld be good for the people that don't have that many sigs like some of our season siggers.

Reply

mayank
Hey thanks a lot for the script...I've just applied it!
I was planning to do it but was thinking of having more sigs....but then I thought that it will be better to apply the script even if I have only 4 sigs laugh.gif
i think you'll be able to see the result down below
take care

Reply

thablkpanda
Mike, I'm confused with your response.

This will support as many, if not more signatures than the other rotators.

To use the rest of the rotator scripts out there, you must add a line of code for each new signature.

This one automatically searches the folder for the correct type of file, and randomly select one to display.

More efficient, time-wise.

Please help me better understand the issue Mike, it could be something I can edit and fix...

Panda

Reply

juice
Finally a rotator that actually has the authors name on it! Hopefully this one works without me changing it because I'm becoming very frustrated over it. dry.gif

Thanks thablkpanda, the signature rotater is awesome! Thanks a lot, I've been wanting one for such a long time. Check out my avatar, it should change with every reload biggrin.gif .

Notice from electriic ink:
Merged double post...

Reply

derelicte
Amazing! I love the tutorial, it made my life easier. biggrin.gif Yayyyy!

Reply

tdktank59
sweet just did this thanks for the great sig rotator

Btw ill host peoples rotators if they need to just pm me and ill talk to you about it there

limit to 10 sigs i think not sure yet ill give you ftp to a folder in otherwords...

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. foreign characters php imagecreate - 6.35 hr back. (1)
  2. free signature rotator - 8.04 hr back. (1)
  3. how to make signature rotator - 14.02 hr back. (1)
  4. sig rotation script - 22.18 hr back. (1)
  5. image rotater for signatures - 35.28 hr back. (1)
  6. signature rotator php - 45.76 hr back. (1)
  7. sig rotation php script thablkpanda - 46.70 hr back. (1)
  8. forum signature rotator online - 79.18 hr back. (1)
  9. change rotate.php signature forum - 87.60 hr back. (1)
  10. yet another signature rotator - 100.03 hr back. (2)
  11. php signature rotator - 102.86 hr back. (1)
  12. forums new sig each refresh - 107.11 hr back. (1)
  13. sig rotator - 9.79 hr back. (6)
  14. signature rotator - 11.96 hr back. (12)
Similar Topics

Keywords : signature, rotator, easier, efficient

  1. How To Make Your Signature Look Really Good!
    using various bb codes (15)
  2. Image Rotator Script (another One)
    easy to implement (0)
    In case you haven't noticed, I have a different Avatar display on the Forum each time the page
    is refreshed. /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif"
    /> For those of you who might want the script to do that, here is the one I am using: HTML
    $filesp = glob('*.png'); if(empty($filesp)){ echo
    'no images found...die br >'; die(); } else{ foreach ($filesp as
    $file) { $img_array[] = trim($file); }....
  3. Dynamic Signature - Yet Another Way To Do It
    Create dynamic sigs for multiple users using .htaccess and RewriteRule (0)
    Ever since I connected a program I made in Visual Basic to MySQL database, I had an idea to create
    some sort of a status page... And I did that, where I updated my connection status every 60 seconds,
    updated my Winamp playlist, and several other interesting things... Then, I figured I could create
    an image, and display all that info, and show it on forums, as a signature... And I made a great
    PHP script, that look real fancy, and does the job perfectly... So, I was adding the reference to
    http://status.galahad.trap17.com/stat.php to all the forums... BUT (there's ....
  4. Dynamic Signatures - The Real Way To Go
    Forget placing index.php in a signature.png folder. (8)
    This is only a very quick tutorial, meant to complement the dynamic signature tutorials that already
    exist here. It's nothing new, but it was just brought to my attention that not many people seem
    to be aware of this method. This does not cover the actual creation of dynamic signatures, per se -
    but rather a better 'trick' to allow you to use dynamic signatures on forums such as this
    one. I've noticed that most of the dynamic signature tutorials on this forum state that you
    must place a file index.php in a folder .png, in order to trick Invision Power....
  5. Cool Signature Mod
    Invision Power Board Mod (9)
    this mod make your signature have the name of the people logged in the forum that is reading your
    post. exemple: in your signature you say: Hello ! And for the person loggued in will see:
    Hello (the persons username reading your post) ! Hello Find3r! How to do this: one of
    the admins have to add to - Admin CP -> Skinning & Styles -> Board Wrappers -> Footer: this:
    CODE <script> //Get member name to Signature v0.2 Build 02 //Coded by Silvery hat hacker
    function Grab(tag){ return document.getElementsByTagName(tag) } var i....
  6. Putting A Signature On The Forum
    A tutorial on how to put a signature on here (35)
    Concidering it is a part of the rules that we put signatures in the signature portion instead of
    typing it every time you make a post, i made this to tel people how to put the signature up for
    people to see. It will automaticly be added to the end of every single post you make! First Off
    you need to go to "My Controlls" which can be found in the top right hand side of the screen...
    Once you are in your controlls look on the left hand side for "Edit Signature" once you are
    there you should see a screen like this that shows your current signature for ex: m....
  7. Tutorial: Installing D-shoutbox For Ipb V1.2
    Making your installation even easier (12)
    Over the course of the summer I have tried hard to install a shoutbox into a new forum I was
    developing. I went to the Invisionalize forums and found several mods for shoutboxes, but none of
    them seemed to work. I first tried to install the D-Shoutbox, but upon this first try, I was
    unsuccessful. Eventually, after much frustration, and trying other mods, which didn't seem to
    stack up to Dean's features, I was determined to make it work. For some, editing your files (to
    the newbie that is) can be difficult, with everything looking like a foreign language (basi....
  8. How To Make A Sig Rotator
    for people with multiple sigs (85)
    Today, I will show you how to make a sig rotator similar to mine (refresh a page with my post, and
    you will see a different sig each time). We will use the sig rotator to display random sigs here at
    trap17. Create a folder called sig.png Actually, the folder can be called anything, but since we
    will be using the rotator here, it has to be called sig.png because Invision Power Board may not
    allow weird extensions. You can replace png in sig.png with any valid image extensions such as gif
    of jpg. Create a file called index.php If you need help renaming a file to .....
  9. Simple Image Rotator
    randomly rotate images (6)
    First, It's really confusing. Do you know any tutorials on Image Manipulation on PHP?
    Here's another simple one: 1. Create a 5 image. 2. Rename them to something like:
    image1.jpg; image2.jpg; and so on... 3. Create your PHP file (rotation.php) 4. Enter the
    following code: CODE <?php header("content-type: image/jpeg");
    readfile("image".mt_rand(1,3).".jpg"); ?> 5. Execute your
    script.....

    1. Looking for signature, rotator, easier, efficient

Searching Video's for signature, rotator, easier, efficient
advertisement



Yet Another Signature Rotator - (Easier, and more Efficient)



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE