Advertisement
YourSenpaiElite

simple discord webhook for MAC

Jan 6th, 2019
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1. <?php
  2.     header('Content-Type: text/html; charset=UTF-8');
  3.    
  4.     file_put_contents("post.log",print_r($_POST,true));
  5.    
  6.     $banreas = $_POST["banreas"];
  7.     $steamid = $_POST["steamid"];
  8.     $playeradr = $_POST["playeradr"];
  9.     $playerdata = $_POST["playerbandata"];
  10.     $webhook = $_POST["webhook"];
  11.    
  12.     if (!$webhook)
  13.         exit("Only post requests!");
  14.    
  15.     function postToDiscord($message,$webhook)
  16.     {
  17.         $data = array("content" => $message, "username" => "Modern AC");
  18.         $curl = curl_init($webhook);
  19.         curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
  20.         curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
  21.         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  22.         return curl_exec($curl);
  23.     }
  24.    
  25.     if (strpos( $banreas, "verified" ) != true) {
  26. $message = "```".$banreas."
  27. SteamID: ".$steamid."
  28. IP-Address: ".$playeradr."
  29. Additional data: ".$playerdata."```";
  30.        
  31.         postToDiscord($message,$webhook);
  32.     }
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement