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"]);
- $BroadcasterLower = strtolower($_GET["Broadcaster"]);
- // 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"]) . ' if you want to slap someone, you need to tell me who you wish to slap!';
- 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();
- //}
- // Tried to slap the broadcaster.
- if ($ToLower == $BroadcasterLower)
- {
- echo htmlspecialchars($_GET["From"]) . ' has just tried to slap ' . $ToLower . '! We can\'t allow that, now can we?';
- die();
- }
- // Tried to commit suicide.
- elseif ($_GET["To"] == $_GET["From"])
- {
- echo 'Well, this is awkward... ' . $ToLower . ' appeara to love to slap himself/herself';
- die();
- }
- // Tried to slap a bot, I know there's many more, add to suit yourself.
- elseif ($ToLower == 'nightbot' || $ToLower == 'wizebot' || $ToLower == 'moobot' || $ToLower == 'streamlabs' || $ToLower == 'streamelements')
- {
- echo 'One does not simply slap a bot!';
- die();
- }
- // The kill methods array.
- $Methods = array
- (
- "with a large trout!",
- "with a sumo wrestler!",
- "with an elephant!"
- );
- // Count the array size, and return a ranodm entry from the array.
- $SlapMethod = $Methods[mt_rand(0, count($Methods) - 1)];
- // Print the output.
- echo htmlspecialchars($_GET["From"]) . ' has just slapped ' . $ToLower . ' ' . $SlapMethod;
- //Example: randomslap.php?Broadcaster=TwitchBroadcaster&From=Myself&To=TwitchUsername
- ?>
Add Comment
Please, Sign In to add comment