Creating a dynamic signature

Anything technology related that does not fit in other categories
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

Ever though it would be cool to have a forum signature that changes every time? But figured it would be a pain to somehow have an automated process upload a new one ever N minutes? Well it's very simple, and does not require anything but a bit of php code, so you do need a php enabled host. You don't even need lot of bandwidth either! This short guide will show you how you can make your own rotational signature for use in forums, emails and other places!


http://www.iceteks.com/articles/parser.php...?article=dynsig

Archived topic from Iceteks, old topic ID:1293, old post ID:11342
Honk if you love Jesus, text if you want to meet Him!
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

I don't think it's working for me, which isn't unusual for me trying something new....

Archived topic from Iceteks, old topic ID:1293, old post ID:11348
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

What is it doing?

Archived topic from Iceteks, old topic ID:1293, old post ID:11349
Honk if you love Jesus, text if you want to meet Him!
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

well I made the "sig" folder and I used the code that you supplied.

The first line in the .htaccess is the Forced php line, then I just changed the paths to where my sigs are and in my sig on here I just linked it to the first image like you said...

Archived topic from Iceteks, old topic ID:1293, old post ID:11370
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

What happends, does it just keep showing the same image?

Archived topic from Iceteks, old topic ID:1293, old post ID:11385
Honk if you love Jesus, text if you want to meet Him!
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

You should have a seperate folder for the "fake" image. That should fix everything. You have to put the .htaccess file in that folder.

So let's say you have yoursite.com/index.html, and you have yoursite.com/sigs/ you would put the .htaccess file in yoursite.com/sigs and not in yoursite.com/. I hope this helps. ;)

Archived topic from Iceteks, old topic ID:1293, old post ID:11466
Honk if you love Jesus, text if you want to meet Him!
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

yeah it's just staying at one image, Ill post the .htaccess file though h/o

Archived topic from Iceteks, old topic ID:1293, old post ID:11476
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

Code: Select all

ForceType application/x-httpd-php




//decide what image number we will display
$numberfile = fopen("number.txt","r");
$number=fgets($numberfile,10);
fclose($numberfile);

$number = $number+5; //adding 5 makes it a bit more random

if($number>9)$number=$number-9;

$numberfile = fopen("number.txt","w");
fputs($numberfile,$number."
"); //rewrite the new number to file
fclose($numberfile);

//display the right image depending on what the number is:
if($number==1)header("Location: [url=http://worldchaos.no-ip.com:12123/wldkos/sig/bg52_a.jpg");]http://worldchaos.no-ip.com:12123/wldkos/s...2_a.jpg");[/url]
if($number==2)header("Location: [url=http://worldchaos.no-ip.com:12123/wldkos/sig/chekaos_b.jpg");]http://worldchaos.no-ip.com:12123/wldkos/s...s_b.jpg");[/url]
if($number==3)header("Location: [url=http://worldchaos.no-ip.com:12123/wldkos/sig/evilwk_c.png");]http://worldchaos.no-ip.com:12123/wldkos/s...k_c.png");[/url]
if($number==4)header("Location: [url=http://worldchaos.no-ip.com:12123/wldkos/sig/freedom_d.jpg");]http://worldchaos.no-ip.com:12123/wldkos/s...m_d.jpg");[/url]
if($number==5)header("Location: [url=http://worldchaos.no-ip.com:12123/wldkos/sig/fries_e.jpg");]http://worldchaos.no-ip.com:12123/wldkos/s...s_e.jpg");[/url]
if($number==6)header("Location: [url=http://worldchaos.no-ip.com:12123/wldkos/sig/glassbanner_f.jpg");]http://worldchaos.no-ip.com:12123/wldkos/s...r_f.jpg");[/url]
if($number==7)header("Location: [url=http://worldchaos.no-ip.com:12123/wldkos/sig/spiralchaos_g.jpg");]http://worldchaos.no-ip.com:12123/wldkos/s...s_g.jpg");[/url]
if($number==8)header("Location: [url=http://worldchaos.no-ip.com:12123/wldkos/sig/star_h.gif");]http://worldchaos.no-ip.com:12123/wldkos/s...r_h.gif");[/url]
if($number==9)header("Location: [url=http://worldchaos.no-ip.com:12123/wldkos/sig/sunkos_i.png");]http://worldchaos.no-ip.com:12123/wldkos/s...s_i.png");[/url]

?>


Archived topic from Iceteks, old topic ID:1293, old post ID:11477
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

Yeah I noticed the adding 5 part does not work how I figured, just add 1. Sometimes you need to hit CTRL+F5 alot. IE seems to be the only browser where this works 100% perfect, sometimes mine will stay the same for like 10 page loads and then it finaly changes. It has to do with the browser's way of caching.

Archived topic from Iceteks, old topic ID:1293, old post ID:11487
Honk if you love Jesus, text if you want to meet Him!
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

You need the .htaccess which tells apache to run the .jpg file as php, the .jpg file is the "bogus" (with the code) and you link to it. It's a tricky process as sometimes it works, sometimes it does not.

Archived topic from Iceteks, old topic ID:1293, old post ID:11497
Honk if you love Jesus, text if you want to meet Him!
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

Oh, and make sure you change the variables (if you're using the second code) to the right paths. :awesome:

Archived topic from Iceteks, old topic ID:1293, old post ID:11498
Honk if you love Jesus, text if you want to meet Him!
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

Oh, I just noticed I forgot to put header("Cache-Control: no-cache, must-revalidate, no-store"); //force browsers to not cache it in the first code example, I'll add it in when I get a chance. It should be right above the if statements. ;)

Archived topic from Iceteks, old topic ID:1293, old post ID:11499
Honk if you love Jesus, text if you want to meet Him!
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

oh so that cache code is what is messing up? Whats the deal with mine red? Is it because there is no <?php in the beginning?

Archived topic from Iceteks, old topic ID:1293, old post ID:11503
Chris Vogel
Posts: 5140
Joined: Fri Jan 10, 2003 1:14 am

Creating a dynamic signature

Post by Chris Vogel »

Red Squirrel wrote: Oh, I just noticed I forgot to put header("Cache-Control: no-cache, must-revalidate, no-store"); //force browsers to not cache it in the first code example, I'll add it in when I get a chance. It should be right above the if statements. ;)
Having to reload that image everytime would be quite annoying -- especially for those of us on dial-up.


I guess it's necessary for it to function though. :) Good thing I can hide the signatures. It's not your signature in particular, but I have never really liked having to scroll through them when reading posts. I do check the profiles from time to time though to see what everyone has cooked up.

Archived topic from Iceteks, old topic ID:1293, old post ID:11506
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

wldkos wrote: oh so that cache code is what is messing up? Whats the deal with mine red?  Is it because there is no <?php in the beginning?
Yes you need to have <?php in the beginning. I sort of did not add it in the code or it would try to run it as php, but I'll try to use that other way to display a <.

Archived topic from Iceteks, old topic ID:1293, old post ID:11508
Honk if you love Jesus, text if you want to meet Him!
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

ok fixed the code on the article. It should work if you use that code. :)

Archived topic from Iceteks, old topic ID:1293, old post ID:11512
Honk if you love Jesus, text if you want to meet Him!
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

Red Squirrel wrote: ok fixed the code on the article. It should work if you use that code. :)
Ill try later... thanks man, make sure you let other people know about that.

Archived topic from Iceteks, old topic ID:1293, old post ID:11545
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

I do not know if you noticed but red updated the script since he made a mistake. Check the page before for details.

Archived topic from Iceteks, old topic ID:1293, old post ID:11556
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

http://www.puttrich.net/rtsupport/sig_randomizer/
red look!

Archived topic from Iceteks, old topic ID:1293, old post ID:11781
Chris Vogel
Posts: 5140
Joined: Fri Jan 10, 2003 1:14 am

Creating a dynamic signature

Post by Chris Vogel »

Error... :cry:

Archived topic from Iceteks, old topic ID:1293, old post ID:11784
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

Sarc wrote: Ok, I must be a complete doof. :(

It still doesn't work for me.

I tried to put the link into the address bar by itself and this is what I got in return.
Even after adding the <?php and ?>.

"Warning: fopen(number.txt): failed to open stream: No such file or directory in /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg on line 6

Warning: fgets(): supplied argument is not a valid stream resource in /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg on line 7

Warning: fclose(): supplied argument is not a valid stream resource in /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg on line 8

Warning: fopen(number.txt): failed to open stream: Permission denied in /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg on line 14

Warning: fputs(): supplied argument is not a valid stream resource in /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg on line 15

Warning: fclose(): supplied argument is not a valid stream resource in /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg on line 16

Warning: Cannot modify header information - headers already sent by (output started at /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg:6) in /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg on line 17

Warning: Cannot modify header information - headers already sent by (output started at /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg:6) in /home/integrit/public_html/Graphics/Mine/Sig/TriStarSig.jpg on line 23


My server is running Apache V: 1.3.28 and PHP V: 4.3.2.

Am I screwed in getting this to work?
Gee sorry for the delay never noticed there was a new post here.

The only thing that error could be is that there's not a number.txt file there. I sort of forgot to mention that part in the article. You have to create a file and call it number.txt and put 0 in it. upload it with the rest and make sure to chmod it to 777.

Archived topic from Iceteks, old topic ID:1293, old post ID:11787
Honk if you love Jesus, text if you want to meet Him!
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

why are you leaving out so much info? Can you re-write this article with every piece of info please?

Archived topic from Iceteks, old topic ID:1293, old post ID:11806
wldkos
Posts: 830
Joined: Mon Feb 24, 2003 12:19 pm

Creating a dynamic signature

Post by wldkos »

takahita_tsukino wrote:
Error... :cry:
weird
I found it yesterday on ibplanet.com, you can put in like 10 different sigs and the forum will switch them randomly for you. it even works with the user cp and the admin can control how many sig's people can have,... very cool.

Archived topic from Iceteks, old topic ID:1293, old post ID:11807
tw2
Posts: 99
Joined: Wed Sep 24, 2003 9:11 pm

Creating a dynamic signature

Post by tw2 »

red
you going to rewite this :stir the pot:

Archived topic from Iceteks, old topic ID:1293, old post ID:11928
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Creating a dynamic signature

Post by Red Squirrel »

One day... :D

Archived topic from Iceteks, old topic ID:1293, old post ID:11929
Honk if you love Jesus, text if you want to meet Him!
Locked