• 0

Randomizing sig pictures?


Question

Recommended Posts

  • 0

There various ways to do it, here's one way..

<?PHP
$URL1="sig1.jpg";
$URL2="sig2.jpg";
$URL3="sig3.jpg";
$URL4="sig4.jpg";
$URL5="sig5.jpg";



srand((double) microtime() * 1000000);
$random = rand(1,5);

if($random == 1)
 ? @header ("Location: $URL1");
elseif ($random == 2)
 ? @header ("Location: $URL2");
elseif ($random == 3)
 ? @header ("Location: $URL3");
elseif ($random == 4)
 ? @header ("Location: $URL4");
elseif ($random == 5)
 ? @header ("Location: $URL5");

?>

  • 0

So if I create a php page, called randsig.php, how do i display my signature? What would I put in the tag?

@ IlliniPi: Sunday there was supposed to be this big contest where hackers were going to see who could take down the most/best sites. Turned out to be a flop. In fact, one of the only sites that got hit was the site where you report hacked websites. :D

  • 0
@ IlliniPi: Sunday there was supposed to be this big contest where hackers were going to see who could take down the most/best sites. Turned out to be a flop. In fact, one of the only sites that got hit was the site where you report hacked websites. :D

Oh yah, I remember hearing that story the other day. Thx for the info. :rofl:

  • 0

Here's one that doesn't care how many images are in the sig folder, nor what type (gif, jpg or png). Just put the images in a subfolder names sig and reference the php file with the tags.

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

}

?>

  • 0

Hmm...

well i've created picksig.php in my main folder with my images in the subfolder 'Assets/Images/Banners/bxx.gif'...

here's the code for the page:

&lt;?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("Assets/Images/Banners/"); 
while(($im = readdir($dir))) { 
? ?if($im != ".." &amp;&amp; $im != "."){ 
? ? ? $image[$i] = $im; 
? ? ? $i++; 
? ?} 
}? 
closedir($dir); 

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

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

?&gt;

But as you can see from my sig, all i get is a red x with the location of the image it can't find being 'picksig.php'

The code in my sig is as such

&lt;IMG&gt;http://eecs.cwru.edu/~jwa4/design/picksig.php&lt;/IMG&gt;

(with square brackets, obviously)

I'm doing something wrong...what is it?

  • 0

Well I got one that works now. It must have been in the code that silly_walk provided ( no offense ;) )

It's tailored to my exact case, but it works and that's what matters.

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

$n = rand(1,14);

if($n &lt; 10) {
header("Location: http://eecs.cwru.edu/~jwa4/design/Assets/Images/Banners/b0".$n.".gif");
}
else header("Location: http://eecs.cwru.edu/~jwa4/design/Assets/Images/Banners/b".$n.".gif");

?&gt;

Nice and simple. In fact, throw in a variable for the max number of banners, and this would work for up to 99 different banners.

Thanks for the help, guys.

  • 0

Here's the kicker now...

The script I have will choose a sig randomly. How 'bout a sig that will choose one based on time, so I can change it, say every 5 minutes or so.

If I know the intervals at which the sig changes, then I can set up an avatar script that pics the avatar to match the banner....know what I mean?

Any ideas?

  • 0
Well I got one that works now.  It must have been in the code that silly_walk provided ( no offense ;) )

It's tailored to my exact case, but it works and that's what matters.

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

$n = rand(1,14);

if($n &lt; 10) {
header("Location: http://eecs.cwru.edu/~jwa4/design/Assets/Images/Banners/b0".$n.".gif");
}
else header("Location: http://eecs.cwru.edu/~jwa4/design/Assets/Images/Banners/b".$n.".gif");

?&gt;

Nice and simple.  In fact, throw in a variable for the max number of banners, and this would work for up to 99 different banners.

Thanks for the help, guys.

Im using that exact code and mine is not working, why?

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

    • No registered users viewing this page.