php Sig Rotate Help

Soldato
Joined
9 Nov 2004
Posts
13,984
Location
Pembrokeshire
hey all,

can't get a sig rotation working for some reason.

i've made a www.projectTTA.com/sigs directory on my server where i've got a rotate.php script, then i've got www.projectTTA.com/sigs/sigs where i've got all the actual images kept.

but when i put [*img]www.projectTTA.com/rotate.php[/*img] (minus the asterix) it doesn't work.

two scripts i've tried for the php file are as follows

Code:
<?php


$files = glob('{*.PNG,*.png,*.JPG,*.jpg,*.GIF,*.gif}', GLOB_BRACE);
readfile($files[array_rand($files)]);


?>
thats from http://robm.me.uk/articles/image-rotation-in-php/

and i've tried the code from the sticky in General Discusion

Code:
<? 

$array[200]; 
$elem = 0; 
$dirname = "sigs"; 
$dh = opendir($dirname); 
while ($file = readdir($dh)) { 
if (!is_dir("$dirname/$file")) 
$array[$elem] = $file; 
$elem = $elem + 1; 
} 

srand((double)microtime() * 10000000); 
$rand_keys = array_rand($array); 
$temp = $array[$rand_keys]; 

header("Location: $dirname/$temp"); 

?>

anyone got any clues as to whats i'm doing wrong?


edit:

the two sigs i'm trying to rotate are at:
http://www.projecttta.com/sigs/sigs/1.jpg
http://www.projecttta.com/sigs/sigs/2.jpg

and both are actually there

1.jpg


2.jpg
 
It does, at least, netpivotal.com's Linux plans do.

Code:
<html>
<head>
<title>sigs</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
&lt;?php 
<p><br>
  $files = glob('{*.PNG,*.png,*.JPG,*.jpg,*.GIF,*.gif}', GLOB_BRACE);<br>
  readfile($files[array_rand($files)]);</p>
<p><br>

  ?&gt;</p>
</body>
</html>
What's happened is you've copied this in the design view of some HTML editor.

Open notepad, whack in:

Code:
<?php


$files = glob('{*.PNG,*.png,*.JPG,*.jpg,*.GIF,*.gif}', GLOB_BRACE);
readfile($files[array_rand($files)]);


?>
And save it as a .php file then upload it :)
 
How to create a rotating signature!

Hi there,

Just follow these instructions:

1. Create a file called index.php and open it in notepad.



2. Paste the following code into that file and save it.

Code:
<?php

$files = glob('{*.PNG,*.png,*.JPG,*.jpg,*.GIF,*.gif}', GLOB_BRACE);
readfile($files[array_rand($files)]);

?>

3. Have all your images that you would like to rotate in either: .PNG , .GIF or .JPG format.



4. Upload the images and the index.php file into the same directory on you PHP enabled webhost/webserver. You should see something like the following when viewing the directory:

9572786123_test.JPG




5. Now that they are uploaded have the direct url to the index.php file handy and ready to type, including the BB IMG tags (see below). For instance the url could be, including the IMG BB tags:

direct url to index.php said:

6. Go to edit your signature and type the direct url to index.php code that you got in the previous section. You should see something similar to the following:





7. Click on preview to check it works, and you would see something similar to below:





8. If you see something similar then you have successfully added a rotating signature and you can click save. If not you must have done something wrong whilst following instructions.



Hope this helps!
 
Last edited:
Lol......sorry...you lot are quick to critise!.....only kidding.


....it was an example, i didnt mean to say follow the instructions religiously


[edit]

I edited the post to include the script you suggested then beansprout....you lot happy yet :P
 
Last edited:
strange, i've popped the three images into the directory with the php script in it and now it just generates random text.

http://www.projecttta.com/sigs/rotate.php

:confused:

it's definately php enabled, we've had forums on the website before we stopped working on the site, so no problems with php...

hmm... just checked the forums and get this

phpBB : Critical Error

Could not connect to the database
 
nikebee said:
strange, i've popped the three images into the directory with the php script in it and now it just generates random text.

http://www.projecttta.com/sigs/rotate.php


it's definately php enabled, we've had forums on the website before we stopped working on the site, so no problems with php...

hmm... just checked the forums and get this

Yes, it will generate random code until its in img tags:

rotate.php


^^ See :) works :p

Edit:

This is code for your sig (you should know though, as your using a pic sig atm ) ;)

PHP:
[img]http://www.projecttta.com/sigs/rotate.php[/img]
 
Back
Top Bottom