Advertisement
Guest User

Untitled

a guest
May 6th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.71 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.  
  5. <title>RTK Gaming</title>
  6.  
  7. </head>
  8.  
  9. <body>
  10.  
  11.     <div align="center">
  12.  
  13.         <form method="post" >
  14.  
  15.             <label>RTK Gaming Account and IP Ban Checker.</label>
  16.  
  17.             <br>
  18.  
  19.                         <br>
  20.  
  21.             <label>Account</label>
  22.  
  23.                         <input type="text" name="accountname" />
  24.  
  25.             <br>
  26.  
  27.                         <br>
  28.  
  29.             <input type="radio" name="ip" value="ipaddress" /><label>Ip Address</label>
  30.  
  31.                         <br>
  32.  
  33.                         <br>
  34.  
  35.                         <input type="submit" name="Submit" value="Check Status" />
  36.  
  37.         </form>
  38.  
  39.     </div>
  40.  
  41.  
  42.  
  43. </body>
  44.  
  45.  
  46.  
  47. </html>
  48.  
  49. <?php
  50.  
  51.     $account = $_POST["accountname"];
  52.  
  53.     $character = $_POST["charactername"];
  54.  
  55.    
  56.  
  57.     /*mysql Variables*/
  58.  
  59.    
  60.  
  61.     /*THIS IS WHERE YOU WANT TO SET YOUR SERVER ADDRESS, DATABASE AND LOGIN INFO*/
  62.  
  63.    
  64.  
  65.     $server = "localhost";
  66.  
  67.     $database = "realmd";
  68.  
  69.     $user = "root";
  70.  
  71.     $pass = "toor";
  72.  
  73.    
  74.  
  75.    
  76.  
  77.     if (isset($_POST['Submit']) and !isset($_POST["ip"]))
  78.  
  79.     {
  80.  
  81.            
  82.  
  83.         /*check to see if account name is banned*/
  84.  
  85.        
  86.  
  87.         if (!$link = mysql_connect("$server", "$user", "$pass"))
  88.  
  89.             {
  90.  
  91.             echo "Could Not Connect To MySQL " .mysql_error();
  92.  
  93.             exit;
  94.  
  95.             }
  96.  
  97.            
  98.  
  99.         if (!mysql_select_db($database, $link))
  100.  
  101.         {
  102.  
  103.             echo "Could Not Select Database!" . mysql_error();
  104.  
  105.             exit;
  106.  
  107.         }
  108.  
  109.        
  110.  
  111.         $sql = "SELECT id FROM account WHERE username='$account'";
  112.  
  113.         $result = mysql_query($sql, $link);
  114.  
  115.        
  116.  
  117.         if (!$result)
  118.  
  119.         {
  120.  
  121.             echo "DB ERROR, Could not Query the DataBase\n";
  122.  
  123.             echo "MySQL Error " .mysql_error();
  124.  
  125.             exit;
  126.  
  127.        
  128.  
  129.         }
  130.  
  131.            
  132.  
  133.         while ($id = mysql_fetch_assoc($result))
  134.  
  135.         {
  136.  
  137.             $accid = $id['id'];
  138.  
  139.            
  140.  
  141.         }
  142.  
  143.        
  144.  
  145.         mysql_freeresult($result);
  146.  
  147.        
  148.  
  149.         echo "Account name found.<br /><br />";
  150.  
  151.        
  152.  
  153.            
  154.  
  155.         $sql = "SELECT active, unbandate, bannedby, bandate, banreason FROM account_banned WHERE id='$accid'";
  156.  
  157.         $result = mysql_query($sql, $link);
  158.  
  159.        
  160.  
  161.         if (!$result)
  162.  
  163.         {
  164.  
  165.             echo "DB Error, Could not query DB\n";
  166.  
  167.             echo "<br />";
  168.  
  169.             echo "MySQL Error: " . mysql_error();
  170.  
  171.         }
  172.  
  173.        
  174.  
  175.         while ($ban = mysql_fetch_assoc($result))
  176.  
  177.         {
  178.  
  179.             $banned = $ban["active"];
  180.  
  181.             $banneddate = $ban["bandate"];
  182.  
  183.             $unbanned = $ban["unbandate"];
  184.  
  185.             $bannedby = $ban["bannedby"];
  186.  
  187.             $banreason = $ban["banreason"];
  188.  
  189.         }
  190.  
  191.         mysql_freeresult($result);
  192.  
  193.        
  194.  
  195.         if ($banned == "1")
  196.  
  197.         {
  198.  
  199.             echo "You Where Banned By $bannedby ! on the $banneddate";
  200.  
  201.             echo "<br />";
  202.  
  203.             echo "Please Contact an administrator if you do not know why.";
  204.  
  205.             echo "<br />";
  206.  
  207.             echo "You will be unbanned on the $unbanned";
  208.  
  209.             echo "<br />";
  210.  
  211.             echo "You Where Banned because $banreason";
  212.  
  213.         }
  214.  
  215.         else
  216.  
  217.         {
  218.  
  219.             echo "Your Account is not Banned!";
  220.  
  221.             exit;
  222.  
  223.         }
  224.  
  225.        
  226.  
  227.         /*end account check*/
  228.  
  229.        
  230.  
  231.     }
  232.  
  233.     /*ip Ban Check*/
  234.  
  235.         if (isset($_POST["Submit"]) and isset($_POST["ip"]))
  236.  
  237.         {
  238.  
  239.             if (!$link = mysql_connect("$server", "$user", "$pass"))
  240.  
  241.             {
  242.  
  243.                 echo "Could Not Connect To MySQL " .mysql_error();
  244.  
  245.                 exit;
  246.  
  247.             }
  248.  
  249.            
  250.  
  251.             if (!mysql_select_db($database, $link))
  252.  
  253.             {
  254.  
  255.                 echo "Could Not Select Database!" . mysql_error();
  256.  
  257.                 exit;
  258.  
  259.             }
  260.  
  261.            
  262.  
  263.             $ip = $_SERVER['REMOTE_ADDR'];
  264.  
  265.             $sql = "SELECT ip, bandate, unbandate, bannedby, banreason FROM ip_banned WHERE ip='$ip'";
  266.  
  267.             $result = mysql_query($sql, $link);
  268.  
  269.        
  270.  
  271.             if (!$result)
  272.  
  273.             {
  274.  
  275.                 echo "DB Error, Could not query DB\n";
  276.  
  277.                 echo "<br />";
  278.  
  279.                 echo "MySQL Error: " . mysql_error();
  280.  
  281.             }
  282.  
  283.            
  284.  
  285.             while ($ipban = mysql_fetch_assoc($result))
  286.  
  287.             {
  288.  
  289.                 $banned = $ipban["ip"];
  290.  
  291.                 $bandate = $ipban["bandate"];
  292.  
  293.                 $unbandate = $ipban["unbandate"];
  294.  
  295.                 $bannedby = $ipban["bannedby"];
  296.  
  297.                 $bannedreason = $ipban["banreason"];
  298.  
  299.             }
  300.  
  301.            
  302.  
  303.             //The date function in this if statement can be changed to how ever you want to format the date.
  304.  
  305.            
  306.  
  307.             if ($banned == $ip)
  308.  
  309.             {
  310.  
  311.                 if ($unbandate <= $bandate)
  312.  
  313.                 {
  314.  
  315.                     echo "You Have Been Perminatly Banned!!";
  316.  
  317.                     echo "<br />";
  318.  
  319.                     echo "If you do not know why you have been permninatly Banned Please Contact An Administrator.";
  320.  
  321.                     exit;
  322.  
  323.                 }
  324.  
  325.                 echo "You Have Been Banned By Ip Address";
  326.  
  327.                 echo "<br />";
  328.  
  329.                 echo "You where Banned on ";
  330.  
  331.                 echo date('m.d.y', $bandate);
  332.  
  333.                 echo " You're Ban will be lifted on ";
  334.  
  335.                 echo date('m.d.y', $unbandate);
  336.  
  337.                 echo "<br />";
  338.  
  339.                 echo "$bannedby has Banned you for $bannedreason";
  340.  
  341.                 echo "<br />";
  342.  
  343.                 echo "If you Disagree With this or this is not your doing then please Contact an Administrator.";
  344.  
  345.             }
  346.  
  347.             else
  348.  
  349.             {
  350.  
  351.                 echo "You Are Good, No Ban";
  352.  
  353.             }
  354.  
  355.             mysql_freeresult($result);
  356.  
  357.            
  358.  
  359.         }
  360.  
  361. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement