コード例 #1
0
ファイル: index.php プロジェクト: Aeirsoul/CSTrade
<?php

$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include_once "{$root}/../include/queries.php";
include_once "{$root}/../include/steam_openid.php";
include_once "{$root}/../include/config.php";
$api_key = file_get_contents("{$root}/../api_key.txt");
$open_id_validate = 0;
if (!empty($_GET['openid_assoc_handle'])) {
    $open_id_validate = SteamSignIn::validate();
}
$steam_open_id_url = SteamSignIn::genUrl();
if ($open_id_validate) {
    $_SESSION["steam_id"] = $open_id_validate;
    query_getUserBySteamID($mysqli, $user_id, $_SESSION["steam_id"]);
    $redirect_page = strtok($_SERVER['REQUEST_URI'], '?');
    if ($user_id == -1) {
        query_createUser($mysqli, $new_user_id, $_SESSION["steam_id"]);
        $_SESSION["user_id"] = $new_user_id;
        $redirect_page = "/profile/";
    } else {
        $_SESSION["user_id"] = $user_id;
    }
    $fetch_string = "http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=" . $api_key . "&steamids=" . $_SESSION["steam_id"];
    $user_JSON_data = @file_get_contents($fetch_string);
    if ($user_JSON_data === FALSE) {
        header("Location: /error.php");
    }
    $user_data = json_decode($user_JSON_data);
    if (count($user_data->response->players) == 1) {
        $player = $user_data->response->players[0];
コード例 #2
0
<?php

session_start();
require 'func.php';
if (isset($_SESSION['steamlogin'])) {
    $steam_login_verify = $_SESSION['steamlogin'];
} else {
    $steam_login_verify = SteamSignIn::validate();
}
if (!empty($steam_login_verify)) {
    $_SESSION['steamlogin'] = $steam_login_verify;
    echo "<h1>Welcome. <a href=dash.php>Continue</a></h1>";
} else {
    $steam_sign_in_url = SteamSignIn::genUrl();
    echo '

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Signin</title>

    <!-- Bootstrap core CSS -->
    <link href="../css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
コード例 #3
0
<?php

if (!isset($_SESSION['steamID'])) {
    ?>
<a href="<?php 
    include_once "SteamSignIn.class.php";
    $steamSignIn = new SteamSignIn();
    if ($body == true) {
        $url = "https://steamcommunity-a.akamaihd.net/public/images/signinthroughsteam/sits_large_noborder.png";
    } else {
        $url = "https://steamcommunity-a.akamaihd.net/public/images/signinthroughsteam/sits_small.png";
    }
    if (isset($_GET['return_url'])) {
        echo $steamSignIn->genUrl('http://' . $_SERVER['HTTP_HOST'] . $_GET['return_url']);
    } else {
        echo $steamSignIn->genUrl('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
    }
    ?>
"><img src="<?php 
    echo $url;
    ?>
" alt="Login through Steam"></a>
<?php 
}
コード例 #4
0
<?php

session_start();
error_reporting(E_ERROR);
// reports all errors
ini_set("display_errors", "1");
// shows all errors
include_once "SteamSignIn.class.php";
$steamSignIn = new SteamSignIn();
// Option to logout
if (isset($_GET['logout'])) {
    $_SESSION = array();
    session_destroy();
    header('location: /');
} else {
    // If the account is not activated yet, ask for their email
    if (isset($_SESSION['steamID']) && $_SESSION['activated'] == false) {
        if ($atNewUserPage == true && isset($_POST['email']) && isset($_POST['charity_ID'])) {
            // If we are already there and an email was provided, add
            // account to the database with details
            // Get more information about the player
            include_once "SteamAPI.class.php";
            $steamAPI = new SteamAPI();
            $playerSummary = $steamAPI->getPlayerInfo($_SESSION['steamID']);
            // Create new user
            include_once 'db.class.php';
            $db = new DB();
            $db->createUser($_SESSION['steamID'], $_POST['email'], $playerSummary['personaname'], $_POST['charity_ID']);
            // Update session variables
            $_SESSION['email'] = $_POST['email'];
            $_SESSION['activated'] = true;
コード例 #5
0
	<p>

	<h3>Interested?</h3>

	<?php 
if (isset($_GET["logout"])) {
    session_start();
    session_destroy();
    session_regenerate_id(TRUE);
}
session_start();
if (isset($_SESSION["steamid"])) {
    $steamid = $_SESSION["steamid"];
}
error_reporting(E_ALL & ~E_NOTICE);
$steamsignin = new SteamSignIn();
if (!isset($steamid)) {
    $steamid = $steamsignin->validate();
    if ($steamid) {
        $_SESSION["steamid"] = $steamid;
    }
}
?>

	<h2>Step 1: Sign in through Steam<?php 
if ($steamid) {
    ?>
 <img src="check.png" style="width:60px;" alt="Validated"><?php 
}
?>
</h2>