Page 1 of 1

[BBCode] Random text signature

Posted: 12 Dec 2011, 10:05
by all4phone
Title: Random text signature
Description: Adds a random text signature. BBCode Random text signature allows you to use randomly changing the signature. Is changed from post to post or reload the page.
Author: I'm sorry but I do not remember where I found it and who is the author of this script, I just adapted and I use on my board (forum).

Create a new PHP file and put the a few citations, each in a new line.
Instead of Signature 1 Signature 2 and so on, insert your own text. You can have as many lines as you like.
[spoiler]Here is a sample code file:

Code: Select all

<?php
                    $quotes = 'Signature 1
                    Signature 2
                   Signature 3
                   Signature 4
                   Signature 5';
                    $split_array = explode("\n", $quotes);
                    $rand_keys = array_rand($split_array, 1);
                 $order   = array("\r\n", "\n", "\r");
                 $replace = '<br />';
                 $los = str_replace($order, $replace, $split_array[$rand_keys]);
                    header("content-type: application/x-javascript");
                    echo "<!--\n
                    document.write('$los');\n
                    //-->";
                ?>
Save the file as 1_signature.php php and send it to the root of your board (forum). This signature can be offered to a few users. Therefore, you must create a file signature.php for each of them and call them 2_signature.php, 3_ signature.php etc.

bbcode usage:

Code: Select all

[signature]{NUMBER}[/signature]
HTML replacement:

Code: Select all

<script type="text/javascript" src="./redirect/to/script_file/{NUMBER}_signature.php"></script>
Helpline:

Code: Select all

Signature: [signature]Number[/signature]
Example:

Code: Select all

[signature]5[/signature]
[/spoiler]
Demo: See my signature on my test board (forum).

[BBCode] Random text signature

Posted: 14 Dec 2011, 21:23
by master412160
can you use bold, bbcodes for this in the .php file?

could someone give a better example with this, like use
[quote]
$quotes = 'Signature 1
Signature 2
Signature 3
Signature 4
Signature 5';
[/code]

[BBCode] Random text signature

Posted: 14 Dec 2011, 22:04
by all4phone
master412160 wrote:can you use bold, bbcodes for this in the .php file?
Easily you can use bbcode's directly in your signature, eg
{color=#4080bF]{b]{signature]1{/signature]{/b]{/color] (I intentionally changed the parentheses)

master412160 wrote:could someone give a better example with this, like use
Read the hidden information inside the spoiler please.