.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
a different sig each time
Old
  (#1)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default a different sig each time - 02-01-2004

While we're at it here's something that should be fun to do, however I'm quite clueless on how to do it.

I figured out at some point that a certain user on a certain forum had turned its signature in a way such as when you hit the "reload" button on your browser, the image displayed in his signature at the bottom of each of his posts was changing each time.

Do you know how he might have done it ?
All I can say is that I believe there's some PHP involved.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: a different sig each time
Old
  (#2)
raiden
Guest
 
Status:
Posts: n/a
Default Re: a different sig each time - 02-01-2004

PHP Code:
$randomnumber gmp_random(10); //generates a number between 0 and 10

echo "<img src=\"http://yourwebspace.de/".$randomnumber.".jpg\">"
I think that should work if you got webspace with 1.jpg till 10.jpg :>
  
Reply With Quote
Re: a different sig each time
Old
  (#3)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: a different sig each time - 02-01-2004

the problem is that forum softwares don't allow PHP in the users' signatures
I believe the guy used something like this:
<IMG src="http://hisdomain.com/image.jpg">
but the JPG image was in fact a PHP file, that would open a file at random in the directory and directly send its content over the network. I don't konw if this is feasible, though.



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: a different sig each time
Old
  (#4)
BAStumm
Member
 
BAStumm's Avatar
 
Status: Offline
Posts: 138
Join Date: Jan 2004
Location: Spokane, WA USA
Default Re: a different sig each time - 03-01-2004

php can generate random images so put the phpcode on YOUR php enabled server then put the image tags here pointing to a image.php file stead of image.jpg

Might be better to generate the image on the fly rather then the example above, see the php image() function.
  
Reply With Quote
Re: a different sig each time
Old
  (#5)
BAStumm
Member
 
BAStumm's Avatar
 
Status: Offline
Posts: 138
Join Date: Jan 2004
Location: Spokane, WA USA
Default Re: a different sig each time - 03-01-2004

lets see if this works... Heres a graph bar I use on my site.


http://bs-linux.com/stats/loadgraph....th=25&avg=0.25
http://bs-linux.com/stats/loadgraph....th=58&avg=0.58


If this works note that both images are the same php file with different ?width settings...

ok so a .php file is ok just can't have any ?blah=blah stuff at the end... If you click the links you will see that the image changes based on my width setting. You can use the image() function to make your sig random looks like. Just do a image from jpg in your php and then randomly use one of the 2 or more images you wish from your site.

http://php.net/image for more info on this...







Last edited by BAStumm; 03-01-2004 at 01:13..
  
Reply With Quote
Re: a different sig each time
Old
  (#6)
BAStumm
Member
 
BAStumm's Avatar
 
Status: Offline
Posts: 138
Join Date: Jan 2004
Location: Spokane, WA USA
Default Re: a different sig each time - 03-01-2004

btw the other suggestion prolly wont work. Reason is it outputs html whereas using the image function outputs actual image header info for png, jpg, gif or whatever type you tell the php code to dynamically generate.

take this sample code from the php.net link I gave before...

Code:
<?php
   header("Content-type: image/png");
   $string = $_GET['text'];
   $im	= imagecreatefrompng("images/button1.png");
   $orange = imagecolorallocate($im, 220, 210, 60);
   $px	= (imagesx($im) - 7.5 * strlen($string)) / 2;
   imagestring($im, 3, $px, 9, $string, $orange);
   imagepng($im);
   imagedestroy($im);
?>
Now modify that with some random number generation to do a

if($num == 1) {$im = imagecreatefrompng("pic1.png");
if)$num == 2) ($im = imagecreatefrompng("pic2.png");
etc...






  
Reply With Quote
Re: a different sig each time
Old
  (#7)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: a different sig each time - 03-01-2004

hey thanks a lot! how could I forget the trusty php.net resource center

that's exactly what I need



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
  
Reply With Quote
Re: a different sig each time
Old
  (#8)
BAStumm
Member
 
BAStumm's Avatar
 
Status: Offline
Posts: 138
Join Date: Jan 2004
Location: Spokane, WA USA
Default Re: a different sig each time - 03-01-2004

Code:
<?php
//image headers
header("Content-type: image/png");
// random number 1-9
$num = RAND(1,9);
// generate image name
$myimage = "pic".$num.".png";
//create image
$im = imagecreatefrompng($myimage);
// output the image binary	 
imagepng($im);
//destroy image
imagedestroy($im);
?>


Like that perhaps.







Last edited by BAStumm; 03-01-2004 at 01:41.. Reason: code clean up :)
  
Reply With Quote
Re: a different sig each time
Old
  (#9)
rob
Moderator
 
rob's Avatar
 
Status: Offline
Posts: 70
Join Date: Jan 2004
Default Re: a different sig each time - 03-01-2004

nice work.
  
Reply With Quote
Re: a different sig each time
Old
  (#10)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: a different sig each time - 03-01-2004

I was to post about the same thing
PHP Code:
<?php
$filename 
sprintf ("sig%d.png"rand (09));
 
$image imagecreatefrompng ($filename);
 
header ("Content-type: image/png");
imagepng ($image);
imagedestroy ($image);
 
?>
creditz to you Brian, of course



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."

Last edited by Pierre-Marie Baty; 03-01-2004 at 02:06..
  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com