Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Set names to lowercase for URL injection.
- $ToLower = strtolower($_GET["To"]);
- // Inject lowercase names to get correct capitalization of usernames.
- $ch = curl_init("https://api.twitch.tv/kraken/channels/" . $ToLower);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $result = curl_exec($ch);
- curl_close($ch);
- // Decode the above JSON data.
- $ToCorrectName = json_decode($result, true);
- // No name was entered after the command.
- if (empty($_GET["To"]))
- {
- echo 'Hey ' . htmlspecialchars($_GET["From"]) . ' to need to specify a user to direct the !give command towards!';
- die();
- }
- // No such Twitch user exists, yet.
- if($ToCorrectName['display_name'] == null)
- {
- echo 'Sorry, ' . htmlspecialchars($_GET["From"]) . ', ' . htmlspecialchars($_GET["To"]) . ' isn\'t a Twitch streamer!';
- die();
- }
- // array of items to give.
- $Items = array
- (
- "a beer! Cheers!",
- "free food!",
- "fellatio! Kinky... ",
- "a cookie!",
- "a kiss!",
- "anal! Well, this just became awkward...",
- "a hug!",
- "an Ambien! Sleep tight Kappa",
- "$20! The ummm... check is in the mail...",
- "$10! The ummm... check is in the mail...",
- "$5! The ummm... check is in the mail...",
- "$1! The ummm... check is in the mail...",
- "$50! The ummm... check is in the mail...",
- "$100! The ummm... check is in the mail...",
- "sex!",
- "a doughnut!",
- "a car!",
- "a Cheeto!",
- "a slice of pizza!",
- "a pear!",
- "a kiwi!",
- "an iPod!",
- "an iPhone!",
- "an iPad",
- "an Android!",
- "their own Batmobile!",
- "a monkey!",
- "a dog!",
- "a cat!",
- "a pet fish",
- "a stinky fish! Icky!",
- "a dead dog! Gross!",
- "a dead cat! Gross!",
- "moldy pizza! Thanks...",
- "a VD! You shouldn't have, really...",
- "an apple!",
- "a Snicker1!",
- "a Reeses!",
- "anal!",
- "an Oreo!",
- "100 viewers!"
- );
- // Count the array size, and return a ranodm entry from the array.
- $Item = $Items[mt_rand(0, count($Items) - 1)];
- // Print the output.
- echo htmlspecialchars($_GET["From"]) . ' gives ' . $ToCorrectName['display_name'] . ' ' . $Item;
- ?>
- Example: Give.php?From=Myself&To=TwitchUsername
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement