Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. <?php
  2. require_once(__DIR__. "/../steamauth/SteamAuth.class.php");
  3. require("inc/paypal.class.php");
  4.  
  5. $global_settings = array(
  6. "db_host" => "HOST", // Host bazy danych
  7. "db_user" => "USER", // Uzytkownik bazy danych
  8. "db_pass" => "PASSWORD", // Haslo bazy danych
  9. "db_name" => "DB_NAME", // Nazwa bazy danych
  10. "license_key" => "0000-0000-0000-0000" // Twój klucz licencyjny otrzymany po zakupie
  11. );
  12.  
  13. $db = new mysqli($global_settings["db_host"], $global_settings["db_user"], $global_settings["db_pass"], $global_settings["db_name"]);
  14. $license_key = $global_settings["license_key"];
  15.  
  16. if (mysqli_connect_errno() != 0){
  17. die("Błąd połączenia z bazą danych: " . mysqli_connect_error());
  18. }
  19. $db->query("SET NAMES utf8");
  20.  
  21. $auth = new SteamAuth($db, $license_key);
  22.  
  23. $apikey = $auth->info("apikey");
  24. $config["title"] = $auth->info("title");
  25. $config["desc"] = $auth->info("desc");
  26. $settings["userid"] = $auth->info("msms_id");
  27. $settings["serviceid"] = $auth->info("msms_serviceid");
  28. $settings["text"] = $auth->info("msms_txt");
  29. $config["msms_psc_pin"] = $auth->info("msms_psc_pin");
  30. $config["pp_email"] = $auth->info("paypal_email");
  31. $config["p24_merchant_id"] = $auth->info("p24_merchant_id");
  32. $config["p24_pos_id"] = $auth->info("p24_pos_id");
  33. $config["p24_crc"] = $auth->info("p24_crc");
  34. $config["p24_type"] = $auth->info("p24_type");
  35.  
  36. $auth->SetOnLoginCallback(function($steamid){
  37. global $db;
  38. $query = $db->query("SELECT * FROM accounts WHERE steamid = '".$steamid."'");
  39. if($query->num_rows > 0) {
  40. header("Location: /sklep/");
  41. } else {
  42. $db->query("INSERT INTO accounts (steamid) VALUES('".$steamid."')");
  43. header("Location: /sklep/");
  44. }
  45. return true;
  46. });
  47.  
  48. $auth->Init();
  49.  
  50. if($auth->IsUserLoggedIn()){
  51. $auth->getData($_SESSION["steamid"]);
  52. $userData = $auth->userData();
  53. }
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement