Lieber Besucher, herzlich willkommen bei: sourceserver.info. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.
Zitat
Admin>Registration>settings>Allow users to register using OpenID
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
<?php function genUrl($returnUrl) { $returnUrl = (!$returnUrl) ? (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] : $returnUrl; $params = array( 'openid.ns' => 'http://specs.openid.net/auth/2.0', 'openid.mode' => 'checkid_setup', 'openid.return_to' => $returnUrl, 'openid.realm' => (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'], 'openid.identity' => 'http://specs.openid.net/auth/2.0/identifier_select', 'openid.claimed_id' => 'http://specs.openid.net/auth/2.0/identifier_select', ); $sep = '&'; return 'https://steamcommunity.com/openid/login?' . http_build_query($params, '', $sep); } function validate() { session_start(); if (isset($_SESSION['HTTP_USER_AGENT'])) { if ($_SESSION['HTTP_USER_AGENT'] != md5($_SERVER['HTTP_USER_AGENT'])) { logout(); return false; } } if (!isset($_SESSION['stamm_steamid64'])) { if(isset($_COOKIE['stamm_steamid64'])) { session_regenerate_id(); $_SESSION['stamm_steamid64'] = $_COOKIE['stamm_steamid64']; $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']); return true; } } else return true; if (!isset($_GET['openid_signed'])) return false; $params = array( 'openid.assoc_handle' => $_GET['openid_assoc_handle'], 'openid.signed' => $_GET['openid_signed'], 'openid.sig' => $_GET['openid_sig'], 'openid.ns' => 'http://specs.openid.net/auth/2.0', ); $signed = explode(',', $_GET['openid_signed']); foreach($signed as $item) { $val = $_GET['openid_' . str_replace('.', '_', $item)]; $params['openid.' . $item] = get_magic_quotes_gpc() ? stripslashes($val) : $val; } $params['openid.mode'] = 'check_authentication'; $data = http_build_query($params); $context = stream_context_create(array( 'http' => array( 'method' => 'POST', 'header' => "Accept-language: en\r\n". "Content-type: application/x-www-form-urlencoded\r\n" . "Content-Length: " . strlen($data) . "\r\n", 'content' => $data, ), )); $result = file_get_contents('https://steamcommunity.com/openid/login', false, $context); preg_match("#^http://steamcommunity.com/openid/id/([0-9]{17,25})#", $_GET['openid_claimed_id'], $matches); $steamID64 = is_numeric($matches[1]) ? $matches[1] : 0; $steamid64_finish = preg_match("#is_valid\s*:\s*true#i", $result) == 1 ? $steamID64 : ''; if(!empty($steamid64_finish)) { session_regenerate_id (true); $_SESSION['HTTP_USER_AGENT'] = md5($_SERVER['HTTP_USER_AGENT']); $_SESSION['stamm_steamid64'] = $steamid64_finish; setcookie("stamm_steamid64", $_SESSION['stamm_steamid64'], time()+60*60*24*10, "/"); return true; } return false; } function calculate_steamid() { $commid = $_SESSION['stamm_steamid64']; if (substr($commid, -1)%2 == 0) $server = 0; else $server = 1; $auth = bcsub($commid, '76561197960265728'); if (bccomp($auth, '0') != 1) return ""; $auth = bcsub($auth, $server); $auth = bcdiv($auth, 2); return 'STEAM_0:'.$server.':'.$auth; } function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") $pageURL .= "s"; $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; else $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; return $pageURL; } if (validate()) { $steamid = calculate_steamid(); echo "thanks for logging in, your Steamid is $steamid"; } else { $url = genUrl(curPageURL()); echo '<a href="'.$url.'"><img src="http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_small.png" /></a>'; } ?> |