Quote of the Day

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.

Quote of the Day

Postby Bad_People » Sun Aug 27, 2006 5:45 am

DO NOT USE THIS CODE. IT WAS WRITTEN BY ME AND I AM A COMPLETE .... yeah anyway.

OK, it's fixed and it's all better. I really hope so.



The brutal irony of this mod code lies in that those who know how to implement this mod have already considered and discarded it, while it is of no use to those who do not. Such is life.

Code: Select all
<html>
<head></head>
<body>
<?php
//These are stored  in the MySQL database, but are provided for
//entertainment purposes only.
$board_config = array();
$board_config['board_timezone']=-6.00; //Central Standard Time
$user_sig="Today's quote is
|*|Methuselah lived to be 969 years old . . . You boys and girls will see more in the next fifty years than Methuselah saw in his whole lifetime.
|!|When angry count four; when very angry, swear.
|!|Civilization is a limitless multiplication of unnecessary necessities.
|!|Man was made at the end of the week's work when God was tired.
|!|If you pick up a starving dog and make him prosperous, he will not bite you. This is the principal difference between a dog and a man.
|!|I have never let my schooling interfere with my education.
|!|Get your facts first, and then you can distort them as much as you please.
|!|Familiarity breeds contempt--and children.
|!|When I was a boy of fourteen, my father was so ignorant I could hardly stand to have the old man around. But when I got to be twenty-one, I was astonished at how much he had learned in seven years.
|!|Let us be thankful for the fools. But for them the rest of us could not succeed.
|!|I don't like to commit myself about heaven and hell -- you see, I have friends in both places.
|!|The holy passion of Friendship is of so sweet and steady and loyal and enduring a nature that it will last through a whole lifetime, if not asked to lend money.
|!|There is no sadder sight than a young pessimist, except an old optimist.
|!|You can't pray a lie.
|!|To cease smoking is the easiest thing I ever did, I ought to know because I've done it a thousand times.
|!|Golf is a good walk spoiled.
|!|When in doubt tell the truth.
|!|What is the difference between a taxidermist and a tax collector? The taxidermist takes only your skin.
|!|All you need in this life is ignorance and confidence, and then success is sure.
|!|I have no color prejudices nor caste prejudices nor creed prejudices. All I care to know is that a man is a human being, and that is enough for me; he can't be any worse.
|!|There are times when one would like to hang the whole human race, and finish the farce.
|!|Any kind of royalty, however modified, any kind of aristocracy, however pruned, is rightly an insult.
|!|Travel has no longer any charm for me. I have seen all the foreign countries I want to except heaven & hell & I have only a vague curiosity about one of those.
|!|The human race is a race of cowards; and I am not only marching in that procession but carrying a banner.
|!|It is by the goodness of God that in our country we have those three unspeakably precious things: freedom of speech, freedom of conscience, and the prudence never to practice either.
|!|For business reasons, I must preserve the outward sign of sanity.
";

//****************************Cut Here****************************
//Find instances of the User Signature and insert this code right before this:
   // If the board has HTML off but the post has HTML
   // on then we process it, else leave it alone

$user_sig_first_array=explode("|*|",$user_sig);
   if(count($user_sig_first_array)>1){
      $user_sig_first=$user_sig_first_array[0];
      $user_sig_last_array=explode("|!|",$user_sig_first_array[1]);
      $user_sig_last_array_size=count($user_sig_last_array);
      if($user_sig_last_array_size>1)
//         $user_sig_last=$user_sig_last_array[rand(0,($user_sig_last_array_size-1))]; //Random quote
         $user_sig_last=$user_sig_last_array[floor((time()/86400)-$user_timezone)%$user_sig_last_array_size]; //Quote of the Day
   $user_sig=$user_sig_first.$user_sig_last;
   }


//****************************Cut Here****************************
   echo $user_sig;
?>
</body>
</html>


Break down of the code is simple. First, edit your signature. Insert a static signature header, like a graphic link to your site, then a line break for aesthetics. Afterward, delimit it with whatever you please. I chose "|*|". Next, add in quotes, or whatever you please, delimited by what you will. I went with "|!|" .
phpBB reads this in as a standard signature.
When it approaches the code to display the signature, this code jumps in, explode-ing the giant signature into a two part array, header and body (I could add a footer, but it's late in the Central US and I'm lazy).
The body is then further explode-d into an array of quotable quotes from your favorite literary cynic. The time() is called to give us seconds since UNIX and then divided by days into seconds (86400), correcting for board timezone. This gives us a number divided into by the number of quotes, taking the remainder and picking that quote.
What purpose does this serve? Heck, I don't know. Why do people still play with the UNIX fortune toy? Something to smile and grin about, I guess.
"Mommy, it's bad people."
Kid say the darndest things.
User avatar
Bad_People
Registered User
 
Posts: 3
Joined: Wed Aug 23, 2006 6:57 pm

Return to [2.0.x] MOD Writers Discussion

Who is online

Users browsing this forum: No registered users and 2 guests