This is an Steam Authentication Methord but its giving me some Notices so can someone help me to resolve this <?php $steam_login_verify =SteamSignIn::validate();if(!empty($steam_login_verify)){ echo "success + $steam_login_verify";}else{ $steam_sign_in_url =SteamSignIn::genUrl(); echo '<a href=\"$steam_sign_in_url\"><img src="http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_large_noborder.png"/></a>';}/** * * @package Steam Community API * @[USER=75352]copyright[/USER] (c) 2010 ichimonai.com * @[USER=749262]license[/USER] http://opensource.org/licenses/mit-license.php The MIT License * */ classSteamSignIn{const STEAM_LOGIN ='https://steamcommunity.com/openid/login'; /** * Get the URL to sign into steam * * @[USER=74751]param[/USER] mixed returnTo URI to tell steam where to return, MUST BE THE FULL URI WITH THE PROTOCOL * @[USER=74751]param[/USER] bool useAmp Use & in the URL, true; or just &, false. * @[USER=23786]return[/USER] string The string to go in the URL */publicstaticfunction genUrl($returnTo =false, $useAmp =true){ $returnTo =(!$returnTo)?(!empty($_SERVER['HTTPS'])?'https':'http').'://'. $_SERVER['HTTP_HOST']. $_SERVER['SCRIPT_NAME']: $returnTo; $params = array('openid.ns'=>'http://specs.openid.net/auth/2.0','openid.mode'=>'checkid_setup','openid.return_to'=> $returnTo,'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 =($useAmp)?'&':'&';returnself::STEAM_LOGIN .'?'. http_build_query($params,'', $sep);} /** * Validate the incoming data * * @[USER=23786]return[/USER] string Returns the SteamID64 if successful or empty string on failure */publicstaticfunction validate(){// Star off with some basic params $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',); // Get all the params that were sent back and resend them for validation $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;} // Finally, add the all important mode. $params['openid.mode']='check_authentication'; // Stored to send a Content-Length header $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(self::STEAM_LOGIN,false, $context); // Validate wheather it's true and if we have a good ID preg_match("#^http://steamcommunity.com/openid/id/([0-9]{17,25})#", $_GET['openid_claimed_id'], $matches); $steamID64 = is_numeric($matches[1])? $matches[1]:0; // Return our final valuereturn preg_match("#is_valid\s*:\s*true#i", $result)==1? $steamID64 :'';}} ?> PHP: This is a simple sign in through steam methord which i found out from herehttp://forums.steampowered.com/forums/showthread.php?t=1430511 What are the errors? There are the errors Notice: Undefined index: openid_assoc_handle in C:\Users\karan\Desktop\xampp\htdocs\LOL\index.php on line 130 Notice: Undefined index: openid_signed in C:\Users\karan\Desktop\xampp\htdocs\LOL\index.php on line 131 Notice: Undefined index: openid_sig in C:\Users\karan\Desktop\xampp\htdocs\LOL\index.php on line 132 Notice: Undefined index: openid_signed in C:\Users\karan\Desktop\xampp\htdocs\LOL\index.php on line 137 Notice: Undefined index: openid_ in C:\Users\karan\Desktop\xampp\htdocs\LOL\index.php on line 140 Notice: Undefined index: openid_claimed_id in C:\Users\karan\Desktop\xampp\htdocs\LOL\index.php on line 163 Notice: Undefined offset: 1 in C:\Users\karan\Desktop\xampp\htdocs\LOL\index.php on line 164 PHP: Well i am not aware why are these errors coming http://i.imgur.com/pedSj7k.png Thanks in advance _Frost
The notices is because the idiot who made the script didn't declare the variables. When a variable is first used, if it does not already exist as a set variable, it will return a notice. It's bad coding, and can lead to unexpected results, but usually the script works just fine. To fix these, you'd have to do something like: $openid_assoc_handle = (isset($_GET['openid_assoc_handle']))? $_GET['openid_assoc_handle'] : '' ; For each variable with a notice, and then assign those into the array.
As PoPSiCLe said, the calling of $_GET without checking they even exist first is a likely cause for hemorrhaging all those errors, but it's possible there are other issues in that TRAIN WRECK of poorly written code that could be adding to it too. Some of it I'm hoping is the forum mangling the code when you cut/paste to here since there are quite obviously some spaces missing (classSteamSignIn ?!?)... but in general there are all sorts of oddities like extra comma's inside arrays (the empty final record making an error), the return function being combined into the comment before it, operations being blindly run inside the class declaration and not it's methods, etc, etc... Do you have a link to the raw original? I'd be willing to take a stab at a rewrite for you to drag it kicking and screaming into being decently coded. What you pasted here is just too mangled to work from as a baseline.
<?php /** * * @package Steam Community API * @[USER=75352]copyright[/USER] (c) 2010 ichimonai.com * @[USER=749262]license[/USER] http://opensource.org/licenses/mit-license.php The MIT License * */ class SteamSignIn { const STEAM_LOGIN = 'https://steamcommunity.com/openid/login'; /** * Get the URL to sign into steam * * @[USER=74751]param[/USER] mixed returnTo URI to tell steam where to return, MUST BE THE FULL URI WITH THE PROTOCOL * @[USER=74751]param[/USER] bool useAmp Use & in the URL, true; or just &, false. * @[USER=23786]return[/USER] string The string to go in the URL */ public static function genUrl($returnTo = false, $useAmp = true) { $returnTo = (!$returnTo) ? (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'] : $returnTo; $params = array( 'openid.ns' => 'http://specs.openid.net/auth/2.0', 'openid.mode' => 'checkid_setup', 'openid.return_to' => $returnTo, '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 = ($useAmp) ? '&' : '&'; return self::STEAM_LOGIN . '?' . http_build_query($params, '', $sep); } /** * Validate the incoming data * * @[USER=23786]return[/USER] string Returns the SteamID64 if successful or empty string on failure */ public static function validate() { // Star off with some basic params $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', ); // Get all the params that were sent back and resend them for validation $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; } // Finally, add the all important mode. $params['openid.mode'] = 'check_authentication'; // Stored to send a Content-Length header $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(self::STEAM_LOGIN, false, $context); // Validate wheather it's true and if we have a good ID preg_match("#^http://steamcommunity.com/openid/id/([0-9]{17,25})#", $_GET['openid_claimed_id'], $matches); $steamID64 = is_numeric($matches[1]) ? $matches[1] : 0; // Return our final value return preg_match("#is_valid\s*:\s*true#i", $result) == 1 ? $steamID64 : ''; } } PHP:
who's Karan? does she know she's being hacked ? "LOL" for the folder name...somebody is being a douche to that girl?