Advertisement
Guest User

Untitled

a guest
Mar 18th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. <?php
  2.  
  3. function get_client_ip() {
  4. $ipaddress = '';
  5. if (getenv('HTTP_CLIENT_IP'))
  6. $ipaddress = getenv('HTTP_CLIENT_IP');
  7. else if(getenv('HTTP_X_FORWARDED_FOR'))
  8. $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
  9. else if(getenv('HTTP_X_FORWARDED'))
  10. $ipaddress = getenv('HTTP_X_FORWARDED');
  11. else if(getenv('HTTP_FORWARDED_FOR'))
  12. $ipaddress = getenv('HTTP_FORWARDED_FOR');
  13. else if(getenv('HTTP_FORWARDED'))
  14. $ipaddress = getenv('HTTP_FORWARDED');
  15. else if(getenv('REMOTE_ADDR'))
  16. $ipaddress = getenv('REMOTE_ADDR');
  17. else
  18. $ipaddress = 'UNKNOWN';
  19. return $ipaddress;
  20. }
  21.  
  22. ini_set('display_errors',1);
  23. ini_set('display_startup_errors',1);
  24. error_reporting(-1);
  25.  
  26.  
  27. define( 'IPS_ENFORCE_ACCESS', TRUE ); // Important so it does not redirect to forums
  28. define( 'IPB_THIS_SCRIPT', 'public' );
  29.  
  30. require_once( '/var/www/initdata.php' );
  31. require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );
  32. require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );
  33.  
  34. $ipbRegistry = ipsRegistry::instance();
  35. $ipbRegistry->init();
  36.  
  37. $identifier = $_GET['u'];
  38. $pass = $_GET['p'];
  39. $hwid = $_GET['hwid'];
  40. $ip = get_client_ip();
  41.  
  42.  
  43. $host = "localhost";
  44. $dbuser = "root";
  45. $dbpass = "VgYwnLFXU8nGk6656HJpcET2";
  46. $connection = mysql_connect($host,$dbuser,$dbpass) or die ("Connection error");
  47. mysql_select_db("log");
  48.  
  49.  
  50. //No user / pass / hwid? -> exit
  51. if($hwid == "")
  52. {
  53. echo "error";
  54. exit();
  55. }
  56.  
  57.  
  58. //Valve ip ranges
  59. $range_low = ip2long("208.64.200.0");
  60. $range_high = ip2long("208.64.203.255");
  61. $ipLong = ip2long($ip);
  62.  
  63. if($ipLong >= $range_low && $ipLong <= $range_high) {
  64. echo "error";
  65. exit();
  66. }
  67.  
  68.  
  69.  
  70. $cleanname = IPSText::parseCleanValue($identifier);
  71.  
  72. $member = IPSMember::load($cleanname, 'all', 'username');
  73. $dbhwid = $member['hwid'];
  74.  
  75. //echo "<pre>"; print_r($member);
  76.  
  77. if(is_null($dbhwid) || strcmp($dbhwid,'reset') == 0) {
  78. mysql_select_db("iwbz1337ipb");
  79. $id = $member['member_id'];
  80. $member['hwid'] = $hwid;
  81. IPSMember::save( $id, array( 'core' => array( 'hwid' => $hwid ) ) );
  82. $member = IPSMember::load($identifier, 'all', 'username');
  83. $dbhwid = $member['hwid'];
  84. }
  85.  
  86.  
  87. if(strcmp($dbhwid,$hwid) != 0) {
  88. echo "error";
  89. mysql_query("INSERT INTO login(name,access,ipaddress,hwid) VALUES('$identifier','HWID ERROR','$ip','$hwid')");
  90. exit();
  91. }
  92.  
  93.  
  94. //Setting things up for response
  95. $key = 'KEh1Iwu1PPBiegUo25OqzY2z9su5I6IK'; // 32 bytes
  96. $iv = 'S1qX6c2ScZqEDyFC'; // 16 bytes
  97. $method = 'aes-256-cfb';
  98. date_default_timezone_set("UTC");
  99. $curtime = date('H');
  100.  
  101. for($count = 0; $count < $hwidLength; $count++) {
  102. $key[$count] = $dbhwid[$count];
  103. }
  104.  
  105. $cleanpass = IPSText::parseCleanValue($pass);
  106.  
  107. if(IPSMember::authenticateMember($member['member_id'],md5($cleanpass))){
  108. //4 = Admin, 6 = Moderatos, 13 = Trusted,21 = VIP
  109. if(IPSMember::isInGroup($member['member_id'],15,true) || IPSMember::isInGroup($member['member_id'],6,true) || IPSMember::isInGroup($member['member_id'],4,true) || IPSMember::isInGroup($member['member_id'],21,true) ){
  110. $curtime .="csgo";
  111. mysql_query("INSERT INTO login(name,access,ipaddress,hwid) VALUES('$identifier','CS:GO','$ip','$hwid')");
  112. } else {
  113. echo "no customer";
  114. mysql_query("INSERT INTO login(name,access,ipaddress,hwid) VALUES('$identifier','NO CUSTOMER','$ip','$hwid')");
  115. exit();
  116. }
  117.  
  118. } else {
  119. echo "no customer";
  120. mysql_query("INSERT INTO login(name,access,ipaddress,hwid) VALUES('$identifier','AUTH FAIL','$ip','$hwid')");
  121. exit();
  122. }
  123. $encryptedTime = base64_encode( openssl_encrypt ($curtime, $method, $key, true, $iv));
  124. echo $encryptedTime;
  125. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement