• 0

Random Sigs


Question

I have one signature, soon to be a couple, in http://www.alexkelm.com/signatures/

Now i've seen people, like timdorr, using those "PHP sigs" well php is enabled on my account but i don't understand how?

How can I setup my profile on Neowin for signature, to randomly roate through the signatures (all *.pngs) in /signatures/ and exclude the ones from /source/ :D

Thanks so much.

- Alex

Link to comment
Share on other sites

Recommended Posts

  • 0

Thread moved to Web programming support

There was a dedicated thread to this topic a while back. I wonder what happened to it :unsure: One of the php gurus will be sure to help you out.

Link to comment
Share on other sites

  • 0

$URL1="sigs/sig1.jpg";

$URL2="sigs/sig2.jpg";

$URL3="sigs/sig3.jpg";

srand((double) microtime() * 1000000);

$random = rand(1,3);

if($random == 1)

@header ("Location: $URL1");

elseif ($random == 2)

@header ("Location: $URL2");

elseif ($random == 3)

@header ("Location: $URL3");

?>

Link to comment
Share on other sites

  • 0

to make a php sig:

name ur pics 1.gif, 2.gif ...... 5.gif

Put them in a folder called "sig"

then copy & paste into notepage

<?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); 

$i = 0; 
$dir = opendir("sig/"); 
while(($im = readdir($dir))) { 
 ? ?if($im != ".." && $im != "."){ 
 ? ? ? $image[$i] = $im; 
 ? ? ? $i++; 
 ? ?} 
} ?
closedir($dir); 

$len = count($image)-1; 
$n = rand(0,$len); 

if(!readfile("sig/".$image[$n])){ 
 ? readfile("icons/error.gif"); 
} 

?>

save as sig.php and place in the main dir so the images folder is below/sub dir

then call it via html/bb code

example [*img*]mysig.php[*/img*] remove *

Link to comment
Share on other sites

  • 0

yes im using a php sig.

P.S Yes i know the dx pic doesnt look right and i need to change it ok ;)

Link to comment
Share on other sites

  • 0
does the sig.php need to be on a php enabled server by any chance or will newin server parse it?

Uh, php code is all server side, meaning the server that the PHP is on, so in short, no, neowin will not parse it and you need your own php enabled server.

Link to comment
Share on other sites

  • 0
Uh, php code is all server side, meaning the server that the PHP is on, so in short, no, neowin will not parse it and you need your own php enabled server.

okay

i know about php but i was wondering on the case of this as it could be this server doing it

ive got a choice of where to put it if neowin parsed it for me

Link to comment
Share on other sites

  • 0

For PNG's,

<?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/png"); 
srand((double)microtime()*1000000);
$i = 0; 
$dir = opendir("/YOUR DIRECTORY/"); 
while(($im = readdir($dir))) { 
   if($im != ".." && $im != "."){ 
      $image[$i] = $im; 
      $i++; 
   } 
}  
closedir($dir); 
$len = count($image)-1; 
$n = rand(0,$len); 
if(!readfile("/YOUR DIRECTORY/".$image[$n])){ 
  readfile("/YOUR DIRECTORY/random.png"); 
} 
?>

:yes:

i did it! see

what theres no upside down arrow? well just look down.

Link to comment
Share on other sites

  • 0
to make a php sig:

name ur pics 1.gif, 2.gif ...... 5.gif

Put them in a folder called "sig"

then copy & paste into notepage

<?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); 

$i = 0; 
$dir = opendir("/sig"); 
while(($im = readdir($dir))) { 
 ? ?if($im != ".." && $im != "."){ 
 ? ? ? $image[$i] = $im; 
 ? ? ? $i++; 
 ? ?} 
} ?
closedir($dir); 

$len = count($image)-1; 
$n = rand(0,$len); 

if(!readfile("icons/".$image[$n])){ 
 ? readfile("icons/error.gif"); 
} 

?>

save as sig.php and place in the main dir so the images folder is below/sub dir

then call it via html/bb code

example [*img*]mysig.php[*/img*] remove *

How do you make this work for both Gif's and jpg's?

Link to comment
Share on other sites

  • 0

With an .htaccess file containing the following:

RewriteEngine on
RewriteRule sig.php(.*) sig.jpg$1

Whenever someone access yourserver.com/sig.jpg , the server actually loads sig.php. But as image.php outputs an jpg header, invision will never know it's really an php script :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.