Kevvv
Noobie
Posts: 8
I'm a llama!
|
|
Dynamic Signatures/Footers
« on: March 08, 2004, 12:10:18 AM » |
|
Hi, on some forums such as vBulletin users can have a dynmamic footer that changes every time a page is refreshed using a php script... well i was jsut woundering, if a) it can be done on YaBB and b) how do i do it thanks.
|
|
|
Logged
|
|
|
|
|
|
|
|
|
|
|
|
|
Shadow's Pawn
Support Team
YaBB God
Posts: 597
ich soll nicht toten
|
|
Re:Dynamic Signatures/Footers
« Reply #10 on: March 09, 2004, 01:04:44 AM » |
|
Here is a freeware script that should do what you need Save this as a file called random.php or anything like that.
<?php ////////////////////////////////////////////////////////////////////// /* Suho1004's PHP Sig Rotator V2.0 */ /* */ /* This script takes an inventory of all image files in a directory */ /* and displays one at random. All you need to do is save this code */ /* in a directory that contains your images (name it what you will, */ /* but make sure it has a ".php" extension). Then just link to this */ /* script to get your random image. */ /* */ /* I would recommend naming this file "index.php," and then you can */ /* just link to the directory itself (like I do in my example). */ /* */ /* Once you've read these instructions, feel free to delete them to */ /* cut down on the file size. I claim no rights to this code, which */ /* means you can do whatever you like with it. Have fun. :-) */ /* */ /* Thanks to TP for the gentle nudging... */ //////////////////////////////////////////////////////////////////////
if ($dir = opendir(".")) { $list = buildimagearray($dir); displayrandomimage($list); }
// This function reads all the files in the current directory and adds all image files to the array $list[] function buildimagearray($dir) { while (false !== ($file = readdir($dir))) { if (!is_dir($file) && getimagesize($file)) { $list[] = $file; } } return $list; }
// This function selects a random image, determines the mime type, opens the file for reading, // and then outputs the image function displayrandomimage($list) { srand ((double) microtime() * 10000000); $sig = array_rand ($list);
$size = getimagesize ($list[$sig]); $fp = fopen($list[$sig], "rb");
if ($size && $fp) { header("Content-type: {$size['mime']}"); fpassthru($fp); exit; } } ?>
|
|
|
Logged
|
apologize \A*pol"o*gize\, v. i. - To lay the foundation for a future offense.
|
|
|
|
|
|
HyperDev
Full Member
Posts: 210
Have drumsticks, will travel.
|
|
Re:Dynamic Signatures/Footers
« Reply #14 on: March 09, 2004, 05:07:14 PM » |
|
Note about all of this: IPB forums won't accept .php as an image suffix. You can solve this with .htaccess. Just have a .jpg (or whatever) processed through PHP's engine, and name your script ***.jpg (or whatever).
|
|
|
Logged
|
--JC HyperDev AdminWill drum for food TO PISS GIRLS OFF! (Only reason I'd do anything.) Proud Member of HHS Drumline Mach8 and [Unknown], I still don't know how you convinced me girls aren't evil. And please, SAVE THE LLAMAS!!!
|
|
|