Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Set the percentage at the chances of "love".
- $LoveValue = mt_rand (0,100);
- // Set names to lowercase for URL injection & string comparison.
- $ToLower = strtolower($_GET["To"]);
- $FromLower = strtolower($_GET["From"]);
- $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 wish to know your chances at love with someone, you must tell me who you wish to have me calculate your chances at love with!';
- 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 check the chances at love with the broadcaster.
- if ($BroadcasterLower == $ToLower)
- {
- echo 'There is a 110% chance at <3! ' . htmlspecialchars($_GET["Broadcaster"]) . ' loves everyone who watches the stream!';
- die();
- }
- // Someone loves themself a little too much.
- if ($ToLower == $FromLower)
- {
- echo $ToCorrectName['display_name'] . ', please... Kappa';
- die();
- }
- // Can't kill a bot...
- if ($ToLower == 'nightbot' || $ToLower == 'wizebot' || $ToLower == 'moobot')
- {
- echo 'Silly homosapian, bots can\'t know real love bleedPurple';
- die();
- }
- // Display first part
- echo 'There is a ' . $LoveValue . '% chance of <3 between ' . htmlspecialchars($_GET["From"]) . ' and ' . $ToCorrectName['display_name'] . '! ';
- // Show "love advice".
- if (0 <= $LoveValue && $LoveValue <= 10)
- {
- echo 'I wouldn\'t count on it lasting. ;(';
- }
- if (11 <= $LoveValue && $LoveValue <= 20)
- {
- echo 'There\'s a slim possibility, but doesn\'t look too promising. :(';
- }
- if (21 <= $LoveValue && $LoveValue <= 30)
- {
- echo 'Alot of work will be needed, but there\'s a possibility.';
- }
- if (31 <= $LoveValue && $LoveValue <= 40)
- {
- echo 'A successful relationship is possible, but you both have to work on it.';
- }
- if (41 <= $LoveValue && $LoveValue <= 50)
- {
- echo 'A relationship is very well possible.';
- }
- if (51 <= $LoveValue && $LoveValue <= 60)
- {
- echo 'The relationship has a reasonable chance of working out, but on the other hand, it might not.';
- }
- if (61 <= $LoveValue && $LoveValue <= 70)
- {
- echo 'Your relationship may suffer good and bad times. If things might not be working out as you would like them to, do not hesitate to talk about it.';
- }
- if (71 <= $LoveValue && $LoveValue <= 80)
- {
- echo 'Spend time together, talk with each other.';
- }
- if (81 <= $LoveValue && $LoveValue <= 90)
- {
- echo 'A relationship has a very good chance of being successful! <3';
- }
- if (91 <= $LoveValue && $LoveValue <= 100)
- {
- echo 'Better put a ring on it right away! <3<3';
- }
- ?>
- Example: Love.php?Broadcaster=TwitchBroadcaster&From=Myself&To=TwitchUsername
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement