<?php /* Created by Marlon Colhado admin@kazeta.com.br */ include_once "./api/AuthFunctions.php"; $SteamAuth = new SteamAuth(); echo $SteamAuth->GenerateSteamGuardCode("Shared Secret Key");
$steamprofile['avatar'] = $_SESSION['steam_avatar']; $steamprofile['avatarmedium'] = $_SESSION['steam_avatarmedium']; $steamprofile['avatarfull'] = $_SESSION['steam_avatarfull']; $steamprofile['personastate'] = $_SESSION['steam_personastate']; $steamprofile['realname'] = $_SESSION['steam_realname']; $steamprofile['primaryclanid'] = $_SESSION['steam_primaryclanid']; $steamprofile['timecreated'] = $_SESSION['steam_timecreated']; $steamprofile['uptodate'] = $_SESSION['steam_uptodate']; $steamID64 = $steamprofile['steamid']; $temp = ''; for ($i = 0; $i < 8; $i++) { $temp .= chr($steamID64 & 0xff); $steamID64 >>= 8; } $guid = md5('BE' . $temp); $auth = new SteamAuth(); // You can use this to do other checks on the person, such as making an account in a database $auth->SetOnLoginCallback(function ($steamid) { return true; // returning true will log them in, false will stop the login (you should put an error message in that case) }); // This handler is for when a login fails Ex: canceled, auth failed, exploit attempt, etc $auth->SetOnLoginFailedCallback(function () { return false; }); // You can use this to do other checks on the person, such as making an modifying a database $auth->SetOnLogoutCallback(function ($steamid) { return true; }); // Always call Init() on pages you want to check a login from. Call this AFTER you set handlers! $auth->Init();
<?php /* Example usage of SteamAuth Uses: handlers, login, SteamID, POST Logout */ include "SteamAuth/SteamAuth.class.php"; $auth = new SteamAuth(); // You can use this to do other checks on the person, such as making an account in a database $auth->SetOnLoginCallback(function ($steamid) { return true; // returning true will log them in, false will stop the login (you should put an error message in that case) }); // This handler is for when a login fails Ex: canceled, auth failed, exploit attempt, etc $auth->SetOnLoginFailedCallback(function () { return true; }); // You can use this to do other checks on the person, such as making an modifying a database $auth->SetOnLogoutCallback(function ($steamid) { return true; }); // Always call Init() on pages you want to check a login from. Call this AFTER you set handlers! $auth->Init(); // Where we handle the POST logout from the form below if (isset($_POST['logout'])) { $auth->Logout(); // The logout function also refreshes the page } //Check if user is logged in if ($auth->IsUserLoggedIn()) { // Display your content here~
<?php session_start(); $steam = new SteamAuth(); $steam->setReturnUrl('example.php'); if ($steam->verifyLogin()) { $steam->setSteamKey('API_KEY'); //YOU CAN GET THIS HERE https://steamcommunity.com/dev/apikey $user = $steam->loadProfile(); $_SESSION['user'] = $user->personaname; echo '<pre>' . print_r($user, true) . '</pre>'; } else { if (!isset($_SESSION['user'])) { echo $steam->getAuthButton(); } } if (isset($_SESSION['user'])) { echo 'Welcome, ' . $_SESSION['user'] . '!'; }
<?php error_reporting(E_ALL); ini_set('display_errors', true); if (!session_id()) { session_start(); } require_once 'assets/classes/SteamAuth.php'; $auth = new SteamAuth(); $auth->Init(); $page = isset($_GET['page']) ? $_GET['page'] : 1; ?> <!DOCTYPE html> <html ng-app="historyApp"> <head> <title>CS:GO.WIN - History</title> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <link rel="stylesheet" type="text/css" href="/assets/css/bootstrap.css"/> <link rel="stylesheet" type="text/css" href="/assets/css/app.css"/> <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:300,600,700,800"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> </head> <body ng-controller="historyController"> <?php include 'header.php'; ?>