Signature Rotation Code

Status
Not open for further replies.
aite so i registered my stuff on the 100webspace thing and got that all done. i enabled php 5 (don't know differences between 4,5 and 6...) and then i uploaded the .php file to the ftp. when i put in the link to where the script is located nothing pops up in my sig. Thing is I don't know how to enable GD. ideas?

PM me links to the images you want to use.
 
Isnt this very simple? When i did it, it was like one paragraph of PHP and that was it. All i did was use a header redirect.

You definitely dont need to use GD for something like this.
Code:
<?php
$randomN=rand(0,3);
if ($randomN==0)
{ header( 'Location: [url]http://www.example.com/images/SIG1.png[/url]' ) ;}

if ($randomN==1)
{ header( 'Location: [url]http://www.example.com/images/SIG2.png[/url]' ) ;}

if ($randomN==2)
{ header( 'Location: [[url]http://www.example.com/images/SIG3.png[/url]' ) ;}

if ($randomN==3)
{ header( 'Location: [url]http://www.example.com/images/SIG4.png[/url]' ) ;}
?>

This was when i was a bit more novice at PHP and used IF constantly. Obviously it will work fine as it is but doing a SWITCH would be more efficient.

In which case, the complete efficient code is:

Code:
<?php

$randomN=rand(0,4);

switch ($randomN) {
case 0:

	header( 'Location: http://www.example.com/images/SIG1.png' ) ;
	break;
	
case 1:

	header( 'Location: http://www.example.com/images/SIG2.png' ) ;
	break;
	
case 2:

	header( 'Location: http://www.example.com/images/SIG3.png' ) ;
	break;
	
case 3:

	header( 'Location: http://www.example.com/images/SIG4.png' ) ;
	break;
	
case 4:

	header( 'Location: http://www.example.com/images/SIG5.png' ) ;
	break;
	
	
default:

    	header( 'Location: http://www.example.com/images/error.png' ) ;
}

?>

All you need to do is upload that (.php) and change the links to your images. Thats it. Then use IMG tags to point to the .php file.
 
Well I haven't tested it, but if zedman is correct and it is that simple, then this is even simpler:

Code:
<?php

$pics = array (
		'http://link-to-image.jpg',
		'http://link-to-image2.jpg',
		'http://link-to-image3.jpg',
		'http://link-to-image4.jpg',
		'http://link-to-image5.jpg',
		);

$rand = rand(0,count($pics)-1);

header ('location:'.$pics[$rand]);

?>
 
Status
Not open for further replies.
Back
Top Bottom