Welcome Guest ( Log In | Register)



9 Pages V   1 2 3 > »   
Reply to this topicStart new topic
> How To Make A Sig Rotator, for people with multiple sigs
Rating 1 V
snlildude87
post Jul 22 2005, 07:45 PM
Post #1


Moderator
***************

Group: Members
Posts: 2,325
Joined: 8-March 05
From: Mawson, Antarctica
Member No.: 4,254



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.
  1. 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.
  2. Create a file called index.php
    If you need help renaming a file to .php, post below. In the file, copy and paste the following code
    index.php:
    CODE
    <?php
    Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
    Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
    Header("Pragma: no-cache");
    Header("Content-Type: image/gif");

    srand((double)microtime()*1000000);
    $randnum = rand(0,1);
    if($randnum == 0)
    {
     readfile("http://img325.imageshack.us/img325/5475/hulunes7rn.jpg");
    }
    else if($randnum == 1)
    {
     readfile("http://img325.imageshack.us/img325/2240/jnguyen5az.jpg");
    }
    ?>

    This is very simple code, but if you don't understand, I'll explain everything later.
  3. Upload sig.png (or whatever you named it) to public_html in your web space.
  4. Go to http://www.trap17.com/forums/edit-signature.html
    In the big text box, add this BBCode:
    CODE
    [img]http://yourdomain.com/sig.png[/img]

    Replace yourdomain.com to your domain. Mine is sang.trap17.com
    Replace sig.png to whatever you named the folder.
Code Explanation
  • The first four lines will make sure that the browser does not cache sigs. If caching is enabled, then the image in the cache will be displayed instead of a random one.
  • CODE
    srand((double)microtime()*1000000);

    This one sets up a random seed. I don't know a lot of PHP, but I know that the higher the number (1000000), the more random it will be. Correct me if I'm wrong on this.
  • CODE
    $randnum = rand(0,1);

    Once our seed is set up, we have to pick a random number from 0 to 1. The random number will be stored in the variable $randnum. The number "1" depends on how many sigs you have. If you have 3 sigs, then you will put a "2" instead of the "1" (0, 1, 2). If you have 5 sigs, then you would put a 4 instead of the 1 (0, 1, 2, 3, 4).
  • CODE
    if($randnum == 0)
    {
     readfile("http://img325.imageshack.us/img325/5475/hulunes7rn.jpg");
    }

    This basically says that if $randnum (our random number) is 0, then it will display the image at http://img325.imageshack.us/img325/5475/hulunes7rn.jpg. Replace http://img325.imageshack.us/img325/5475/hulunes7rn.jpg with the URL of your image.
  • CODE
    else if($randnum == 1)
    {
     readfile("http://img325.imageshack.us/img325/2240/jnguyen5az.jpg");
    }

    If $randnum is 1, then it will display http://img325.imageshack.us/img325/2240/jnguyen5az.jpg. Change http://img325.imageshack.us/img325/2240/jnguyen5az.jpg to the URL of your 2nd image. If you have more images
  • CODE
    else if($randnum == 2)
    {
     readfile("http://img325.imageshack.us/img325/2240/blah.jpg");
    }

    If you have more images, then add 1 to the the number after "== " and add 1 to the last number at $randnum = rand(0,1);.

Want Something Shorter?

Go here: http://www.trap17.com/forums/index.php?sho...ndpost&p=189391

That's it! Post any questions below!

This post has been edited by snlildude87: Sep 26 2005, 01:43 AM
Go to the top of the page
 
+Quote Post
badinfluence
post Jul 22 2005, 08:42 PM
Post #2


Super Member
*********

Group: Members
Posts: 283
Joined: 10-October 04
Member No.: 1,637



cool.. rating 8/10. good for those sig makers, perhaps tongue.gif i will sure test it out when my account is back..
Go to the top of the page
 
+Quote Post
Saint_Michael
post Jul 23 2005, 12:27 AM
Post #3


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,315
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew



have an error

Parse error: parse error, unexpected T_ELSE in /home/saint/public_html/sig.png/index.php on line 20
Go to the top of the page
 
+Quote Post
Saint_Michael
post Jul 23 2005, 12:31 AM
Post #4


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,315
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew



heres what i did but an error should up on line 20 "randum==2"

CODE
<?php
Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
Header("Pragma: no-cache");
Header("Content-Type: image/gif");

srand((double)microtime()*1000000);
$randnum = rand(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,2
8);
if($randnum == 0)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-2.jpg");
}
else if($randnum == 1)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-3.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-4.jpg");
}
else if($randnum == 2)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-5.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-6.gif");
}
else if($randnum == 3)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-7.gif");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-8.jpg");
}
else if($randnum == 4)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-8.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-8-1.gif");
}
else if($randnum == 5)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-9.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-10.jpg");
}
else if($randnum == 6)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-11.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-11-1.gif");
}
else if($randnum == 7)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-12.png");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-12-1.gif");
}
else if($randnum == 8)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-13.png");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-14.png");
}
else if($randnum == 9)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-15.png");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-16.jpg");
}
else if($randnum == 10)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-17.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-18.jpg");
}
else if($randnum == 11)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-19.png");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-20.png");
}
else if($randnum == 12)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-21.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-22.jpg");
}
else if($randnum == 13)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-23.png");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-24.jpg");
}
else if($randnum == 14)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-25.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-26.jpg");
}
else if($randnum == 15)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-27.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-28.jpg");
}
else if($randnum == 16)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-29.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-30.jpg");
}
else if($randnum == 17)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-31.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-32.jpg");
}
else if($randnum == 18)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-34.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-35.png");
}
else if($randnum == 19)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-36.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-37.jpg");
}
else if($randnum == 20)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-38.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-39.jpg");
}
else if($randnum == 21)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-40.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-41.jpg");
}
else if($randnum == 22)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-42.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-43.jpg");
}
else if($randnum == 23)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-44.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-44-1.jpg");
}
else if($randnum == 24)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-45.png");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-45-1.png");
}
else if($randnum == 25)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-46.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-47.jpg");
}
else if($randnum == 26)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-48.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-49.jpg");
}
else if($randnum == 27)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-50.jpg");
}
{
readfile("http://www.saint-michael.trap17.com/images/sig1-51.jpg");
}
else if($randnum == 28)
{
readfile("http://i14.photobucket.com/albums/a305/saint-michael/sig1-52.jpg");
}
?>
Go to the top of the page
 
+Quote Post
snlildude87
post Jul 23 2005, 01:54 AM
Post #5


Moderator
***************

Group: Members
Posts: 2,325
Joined: 8-March 05
From: Mawson, Antarctica
Member No.: 4,254



Try this code instead:

CODE
<?php
Header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
Header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
Header("Pragma: no-cache");
Header("Content-Type: image/gif");

srand((double)microtime()*1000000);
$randnum = rand(0,54);
if($randnum == 0)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-2.jpg");
}
else if($randnum == 1)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-3.jpg");
}
else if($randnum == 2)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-4.jpg");
}
else if($randnum == 3)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-5.jpg");
}
else if($randnum == 4)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-6.gif");
}
else if($randnum == 5)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-7.gif");
}
else if($randnum == 6)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-8.jpg");
}
else if($randnum == 7)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-8.jpg");
}
else if($randnum == 8)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-8-1.gif");
}
else if($randnum == 9)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-9.jpg");
}
else if($randnum == 10)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-10.jpg");
}
else if($randnum == 11)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-11.jpg");
}
else if($randnum == 12)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-11-1.gif");
}
else if($randnum == 13)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-12.png");
}
else if($randnum == 14)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-12-1.gif");
}
else if($randnum == 15)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-13.png");
}
else if($randnum == 16)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-14.png");
}
else if($randnum == 17)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-15.png");
}
else if($randnum == 18)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-16.jpg");
}
else if($randnum == 19)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-17.jpg");
}
else if($randnum == 20)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-18.jpg");
}
else if($randnum == 21)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-19.png");
}
else if($randnum == 22)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-20.png");
}
else if($randnum == 23)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-21.jpg");
}
else if($randnum == 24)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-22.jpg");
}
else if($randnum == 25)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-23.png");
}
else if($randnum == 26)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-24.jpg");
}
else if($randnum == 27)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-25.jpg");
}
else if($randnum == 28)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-26.jpg");
}
else if($randnum == 29)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-27.jpg");
}
else if($randnum == 30)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-28.jpg");
}
else if($randnum == 31)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-29.jpg");
}
else if($randnum == 32)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-30.jpg");
}
else if($randnum == 33)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-31.jpg");
}
else if($randnum == 34)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-32.jpg");
}
else if($randnum == 35)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-34.jpg");
}
else if($randnum == 36)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-35.png");
}
else if($randnum == 37)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-36.jpg");
}
else if($randnum == 38)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-37.jpg");
}
else if($randnum == 39)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-38.jpg");
}
else if($randnum == 40)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-39.jpg");
}
else if($randnum == 41)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-40.jpg");
}
else if($randnum == 42)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-41.jpg");
}
else if($randnum == 43)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-42.jpg");
}
else if($randnum == 44)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-43.jpg");
}
else if($randnum == 45)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-44.jpg");
}
else if($randnum == 46)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-44-1.jpg");
}
else if($randnum == 47)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-45.png");
}
else if($randnum == 48)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-45-1.png");
}
else if($randnum == 49)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-46.jpg");
}
else if($randnum == 50)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-47.jpg");
}
else if($randnum == 51)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-48.jpg");
}
else if($randnum == 52)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-49.jpg");
}
else if($randnum == 53)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-50.jpg");
}
else if($randnum == 54)
{
readfile("http://www.saint-michael.trap17.com/images/sig1-51.jpg");
}
else if($randnum == 55)
{
readfile("http://i14.photobucket.com/albums/a305/saint-michael/sig1-52.jpg");
}
?>


It might not work because I went through it in a second, but I'm 99% sure that it should. smile.gif
Go to the top of the page
 
+Quote Post
Saint_Michael
post Jul 23 2005, 02:05 AM
Post #6


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,315
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew



yeah i had a funny feeling it was something like that but the else if statements threw me off a bit thanks again
Go to the top of the page
 
+Quote Post
snlildude87
post Jul 23 2005, 02:46 AM
Post #7