Create a random signature with phpbb

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Suggested Hosts
Locked
Mini Franki
Registered User
Posts: 119
Joined: Tue Jan 23, 2007 4:59 am
Contact:

Create a random signature with phpbb

Post by Mini Franki »

Hi,

I want to put a random signature(image change at each loading)... But i cant do that with a html bbcode.

Its possible to create a php bbcode??

Or its possible to do what i want??

thx
Last edited by Mini Franki on Mon Apr 28, 2008 5:48 pm, edited 1 time in total.

chris207
Registered User
Posts: 182
Joined: Thu Mar 31, 2005 4:18 am
Location: Maine, US
Contact:

Re: Create a bbcode with php code

Post by chris207 »

There are sites/services that let you make dynamic signature images, I believe. I've never heard of making a php bbcode.

Mini Franki
Registered User
Posts: 119
Joined: Tue Jan 23, 2007 4:59 am
Contact:

Re: Create a bbcode with php code

Post by Mini Franki »

I cant because the images used for my random sig are already dynamic :D (crysis stats on my sig)

Or, Can i put this page in my sig??? :

Code: Select all

<? 
$imgs = array("http://sign.crytools.com/01/6178.png", "http://sign.crytools.com/01/6177.png", "http://sign.crytools.com/01/6183.png", "http://sign.crytools.com/01/6184.png", "http://sign.crytools.com/01/6187.png"); 
srand ((double)microtime()*1000000); 
shuffle($imgs); 
echo '<IMG SRC="' . $imgs[0] . '" BORDER = "0">'; 
?> 

Mini Franki
Registered User
Posts: 119
Joined: Tue Jan 23, 2007 4:59 am
Contact:

Re: Create a bbcode with php code

Post by Mini Franki »

up

User avatar
stickerboy
Former Team Member
Posts: 7349
Joined: Mon Mar 29, 2004 2:27 pm
Location: Airdrie, UK (127.0.0.1)
Name: Kenny Cameron
Contact:

Re: Create a bbcode with php code

Post by stickerboy »

Took a bit to remember where i'd posted this, but found it.
I'm not sure about the security implications of doing this, so it may be worth a search of the forums/google beforehand.
cherokee red wrote:1. create a folder called filename.file-extension (eg. image.gif, or picture.jpg)
2. create a php file in there called index.php
3. Use you php code on the index file
4. In your signature use the [img] bbcode as normal
ie. [img]http://www.yoursite.com/picture.jpg[/img]
I'm a web-designing code-decrypting tech-support musician
|| Twitter || Flickr || phpBB Snippets ||
Formerly known as cherokee red

Mini Franki
Registered User
Posts: 119
Joined: Tue Jan 23, 2007 4:59 am
Contact:

Re: Create a bbcode with php code

Post by Mini Franki »

I already search on the forum and google and noting

I tried your trick and that nor work... Someone has another solution???

thx

Mini Franki
Registered User
Posts: 119
Joined: Tue Jan 23, 2007 4:59 am
Contact:

Re: Create a random signature with phpbb

Post by Mini Franki »

up

Mini Franki
Registered User
Posts: 119
Joined: Tue Jan 23, 2007 4:59 am
Contact:

Re: Create a random signature with phpbb

Post by Mini Franki »

UP!!!

EinsteinBB
Registered User
Posts: 1
Joined: Sun Oct 05, 2008 10:17 pm

Re: Create a random signature with phpbb

Post by EinsteinBB »

Thank you, Cherokee! It would've taken me much longer to see that little trick, and I'm sure I would've implemented it in a slightly more roundabout (read "stupid and inefficient") method. Anyways, I have done exactly what Mini Franki is attempting, so I hope he's subscribed to this topic months later or has since found a similar solution. Do what Cherokee Red describes, except use PHP's built-in readfile() function to implement it instead of echo; you don't want to return a text string to the page like in a regular HTML file, you want to instead return an image itself, and you can do that in only one line if you have access to a PHP-enabled Web host. So, take that array you made, but instead of using $imgs[0] inside an echo statement, use it inside a readfile() statement after you send the proper header to the calling page:

Code: Select all

// all of the stuff you had from above up until the echo statement
header("Content-type: image/png");
readfile($imgs[0]);
?>
This code, when placed in the file created using Cherokee's suggestion, will allow your random image to work perfectly in your signature; don't forget to change the MIME type to fit your image format. However, BBCode / phpBB doesn't even recognize that you're asking it to point to a .php file instead of an image file. (Actually, you can even bypass the built-in signature image size limits, if you first apply your signature while using a small image before you make it choose from the array. It checks only when you submit the signature, not when it is included into the forum's page.) Oh, and by the way, you shouldn't need the srand function in there unless you've got a VERY backwards version of PHP on the server... usually the random number generator is already seeded, and subsequent seeds actually make the results less random rather than more. I hope this helps; it certainly did a lot for me!

User avatar
Volunteer Forum
Registered User
Posts: 400
Joined: Mon Sep 12, 2005 9:59 pm

Re: Create a random signature with phpbb

Post by Volunteer Forum »

I was thinking about this too.
Would be nice to add more signatures that could show randomly :)
Everything that is not perfect is a flaw [",]

Locked

Return to “[3.0.x] MOD Requests”