Advertisement
kyroskoh

Twitch CustomAPI - Random Quote

May 7th, 2016
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.41 KB | None | 0 0
  1. <?php
  2. // Array of random quotes.
  3. $Quotes = array
  4. (
  5.     "A woman's mind is cleaner than a man's: She changes it more often.",
  6.     "Do not take life too seriously. You will never get out of it alive.",
  7.     "I believe that if life gives you lemons, you should make lemonade... And try to find somebody whose life has given them vodka, and have a party.",
  8.     "If you haven't got anything nice to say about anybody, come sit next to me.",
  9.     "I'm sorry, if you were right, I'd agree with you.",
  10.     "Procrastination is the art of keeping up with yesterday.",
  11.     "Go to Heaven for the climate, Hell for the company.",
  12.     "If two wrongs don't make a right, try three.",
  13.     "Age is something that doesn't matter, unless you are a cheese.",
  14.     "Expert: a man who makes three correct guesses consecutively.",
  15.     "Roses are red, violets are blue, I'm schizophrenic, and so am I.",
  16.     "My life needs editing.",
  17.     "If you're going to do something tonight that you'll be sorry for tomorrow morning, sleep late.",
  18.     "Wine is constant proof that God loves us and loves to see us happy.",
  19.     "They say marriages are made in Heaven. But so is thunder and lightning.",
  20.     "When we talk to God, we're praying. When God talks to us, we're schizophrenic.",
  21.     "Reality continues to ruin my life.",
  22.     "If women ran the world we wouldn't have wars, just intense negotiations every 28 days.",
  23.     "If at first you don't succeed, find out if the loser gets anything.",
  24.     "Everything I like is either illegal, immoral or fattening.",
  25.     "I'm like old wine. They don't bring me out very often - but I'm well preserved.",
  26.     "Anytime you see a turtle up on top of a fence post, you know he had some help.",
  27.     "As a child my family's menu consisted of two choices: take it or leave it.",
  28.     "I'm for whatever gets you through the night.",
  29.     "Lead us not into temptation. Just tell us where it is; we'll find it.",
  30.     "Between two evils, I always pick the one I never tried before.",
  31.     "I distrust camels, and anyone else who can go a week without a drink.",
  32.     "I believe in rules. Sure I do. If there weren't any rules, how could you break them?",
  33.     "Any kid will run any errand for you, if you ask at bedtime.",
  34.     "I cook with wine, sometimes I even add it to the food.",
  35.     "Men are liars. We'll lie about lying if we have to. I'm an algebra liar. I figure two good lies make a positive.",
  36.     "I don't believe in the after life, although I am bringing a change of underwear.",
  37.     "Never fight an inanimate object.",
  38.     "If you live to be one hundred, you've got it made. Very few people die past that age.",
  39.     "Cure for an obsession: get another one.",
  40.     "The next time you have a thought... let it go.",
  41.     "Only the mediocre are always at their best.",
  42.     "If at first you don't succeed... so much for skydiving.",
  43.     "The way my luck is running, if I was a politician I would be honest.",
  44.     "The IRS! They're like the Mafia, they can take anything they want!",
  45.     "I was born in very sorry circumstances. Both of my parents were very sorry.",
  46.     "If you can't tell a spoon from a ladle, then you're fat!",
  47.     "Children are smarter than any of us. Know how I know that? I don't know one child with a full time job and children.",
  48.     "I have had a perfectly wonderful evening, but this wasn't it.",
  49.     "Electricity is really just organized lightning.",
  50.     "If men knew how women pass the time when they are alone, they'd never marry.",
  51.     "Forty for you, sixty for me. And equal partners we will be.",
  52.     "I was sleeping the other night, alone, thanks to the exterminator.",
  53.     "I am certain there is too much certainty in the world.",
  54.     "I never drink water because of the disgusting things that fish do in it.",
  55.     "From there to here, and here to there, funny things are everywhere.",
  56.     "I don't care what the haters and naysayers say. If they make jokes about me, I'll laugh because they'll probably be funny.",
  57.     "Life would be tragic if it weren't funny.",
  58.     "Look up at the stars and not down at your feet. Try to make sense of what you see, and wonder about what makes the universe exist. Be curious.",
  59.     "There is no unique picture of reality.",
  60.     "In my opinion, there is no aspect of reality beyond the reach of the human mind.",
  61.     "People who boast about their I.Q. are losers.",
  62.     "What was God doing before the divine creation?",
  63.     "I'm never any good in the morning. It is only after four in the afternoon that I get going.",
  64.     "I'm not that good looking. That's why 'Gangnam Style' works. If someone handsome uses that phrase it's just awkward. But if someone like me uses it, it's funny.",
  65.     "By the way, I'm funniest when I'm not being funny. I'm better to laugh at than with, pretty much.",
  66.     "I'm never afraid to try something if I think it's funny. And I know I'll regret it if I don't.",
  67.     "It's a funny thing, the less people have to live for, the less nerve they have to risk losing nothing.",
  68.     "It's always funny until someone gets hurt. Then it's just hilarious.",
  69.     "To all the girls out there who think being funny is not sexy, you are wrong!",
  70.     "What other people call dark and despairing, I call funny.",
  71.     "Many comedians have a dark side that lets them take a negative thing and turn it funny.",
  72.     "It's funny the way most people love the dead. Once you are dead, you are made for life.",
  73.     "Cheech and I used to call ourselves musicians; we never called ourselves comedians. We were musicians that were funny.",
  74.     "Almost anything can be funny if said the right way - but it has to be said the right way.",
  75.     "Chaos in the midst of chaos isn't funny, but chaos in the midst of order is.",
  76.     "British politics, as the world knows, is a joke. Yet it's rarely funny.",
  77.     "Experience is a funny thing. You don't always have it when you need it.",
  78.     "I don't say things to be offensive; I say things because they're funny to me. It amuses me.",
  79.     "Children are the most honest critics. They will say 'You're funny', but also 'You're pathetic - go away.'",
  80.     "If I studied all my life, I couldn't think up half the number of funny things passed in one session of congress.",
  81.     "Funny thing is that the poorer people are, the more generous they seem to be.",
  82.     "If you watch kids looking at something on television, even something that's produced for them and is supposed to be funny, what you'll notice is that they don't laugh.",
  83.     "It's hard to be funny when you have to be clean.",
  84.     "Go for it now. The future is promised to no one.",
  85.     "Life is 10% what happens to you and 90% how you react to it.",
  86.     "Good, better, best. Never let it rest. 'Til your good is better and your better is best.",
  87.     "Accept the challenges so that you can feel the exhilaration of victory.",
  88.     "The secret of getting ahead is getting started.",
  89.     "It does not matter how slowly you go as long as you do not stop.",
  90.     "Keep your eyes on the stars, and your feet on the ground.",
  91.     "Aim for the moon. If you miss, you may hit a star.",
  92.     "Problems are not stop signs, they are guidelines.",
  93.     "You have to learn the rules of the game. And then you have to play better than anyone else.",
  94.     "By failing to prepare, you are preparing to fail.",
  95.     "Perseverance is failing 19 times and succeeding the 20th.",
  96.     "Do the difficult things while they are easy and do the great things while they are small. A journey of a thousand miles must begin with a single step.",
  97.     "I'd rather attempt to do something great and fail than to attempt to do nothing and succeed.",
  98.     "When you reach the end of your rope, tie a knot in it and hang on.",
  99.     "Well done is better than well said.",
  100.     "If you're going through hell, keep going.",
  101.     "Even if you fall on your face, you're still moving forward.",
  102.     "A goal is a dream with a deadline.",
  103.     "The harder the conflict, the more glorious the triumph.",
  104.     "You can never quit. Winners never quit, and quitters never win.",
  105.     "If you don't like how things are, change it! You're not a tree.",
  106.     "If you want to conquer fear, don't sit home and think about it. Go out and get busy.",
  107.     "You need to overcome the tug of people against you as you reach for high goals.",
  108.     "I really believe that everyone has a talent, ability, or skill that he can mine to support himself and to succeed in life.",
  109.     "Be gentle to all and stern with yourself.",
  110.     "It's always too early to quit.",
  111.     "It is very important to know who you are. To make decisions. To show who you are.",
  112.     "A somebody was once a nobody who wanted to and did.",
  113.     "The wise does at once what the fool does at last.",
  114.     "You never know what motivates you.",
  115.     "The best preparation for tomorrow is doing your best today.",
  116.     "No matter what people tell you, words and ideas can change the world.",
  117.     "I can't change the direction of the wind, but I can adjust my sails to always reach my destination.",
  118.     "If opportunity doesn't knock, build a door.",
  119.     "No act of kindness, no matter how small, is ever wasted.",
  120.     "There are two ways of spreading light: to be the candle or the mirror that reflects it.",
  121.     "Someone is sitting in the shade today because someone planted a tree a long time ago.",
  122.     "Even if I knew that tomorrow the world would go to pieces, I would still plant my apple tree.",
  123.     "With self-discipline most anything is possible.",
  124.     "The measure of who we are is what we do with what we have.",
  125.     "Don't limit yourself. Many people limit themselves to what they think they can do. You can go as far as your mind lets you. What you believe, remember, you can achieve."
  126. );
  127. // Set variable from GET data.
  128. $GeneralQuery = $_GET["GeneralQuery"];
  129. // Count the items in the array.
  130. $QuotesInArray = count($Quotes);
  131. // Generate a quote array number.
  132. $QuoteNumber = mt_rand(0, $QuotesInArray - 1);
  133. // Get the correct quote array number for requests.
  134. $CorrectQuoteNumber = $QuoteNumber + 1;
  135. // And the actual quote associated in the array.
  136. $Quote = $Quotes[$QuoteNumber];
  137. // Check for numeric input for requesting a specific quote.
  138. if(is_numeric($_GET["GeneralQuery"]))
  139. {
  140.     // Input needs to be less than the number of quotes total, greater than or equal to 1.
  141.     // Nested IFs work, using || caused... Problems.
  142.     if($GeneralQuery >= 1)
  143.     {  
  144.         if($GeneralQuery <= $QuotesInArray)
  145.         {
  146.             // Get the correct quote number for requests.
  147.             $AskedQuote = $GeneralQuery - 1;
  148.             // Show the requested quote.
  149.             echo 'Here is Quote # ' . $GeneralQuery . ' "' . $Quotes[$AskedQuote] . '"';
  150.             die();
  151.         }
  152.     }
  153. // Invalid quote range inputted.
  154.     echo 'There is no quote matching ' . $GeneralQuery . '!' . ' Valid quotes are 1-' . $QuotesInArray;
  155. }
  156. // Show a random quote.
  157. else
  158. {
  159.     echo 'Quote # ' . $CorrectQuoteNumber . ' "' . $Quote . '"';
  160. }
  161. ?>
  162.  
  163. Example:
  164. Quote.php?
  165. or
  166. Quote.php?GeneralQuery=72
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement