Code Monkey home page Code Monkey logo

steamauthoop's Introduction

SteamAuthOOP

OOP-based Steam-Login library

Features

  • One-File class
  • Doesnt rely on an external library
  • Easy to use
  • Easy to modify with commented code and function reference
  • Saves all information the Steam-API provides on a per-user basis
  • Doesnt recreate/delete your session if you use it elsewhere

Installation

  • Drop the steamauthoop.class.php file into your projects directory
  • Insert your API-Key from http://steamcommunity.com/dev/apikey into the config ($settings["apikey"])
  • Include it with require "steamauthoop.class.php";
  • Initialize it with $steam = new SteamAuthOOP();

Basic usage

If you want to have a link, go with <a href="<?php echo $steam->loginUrl(); ?>">Link</a>

Check if the user is logged in with $steam->loggedIn(); (Will return true or false)

User-Data is accessible through $steam->varName; You can find a basic list of variables in the demo file or a more advanced one in the code.

Example

<?php
  require("steamauthoop.class.php");
  $steam = new SteamAuthOOP();
  if ($steam->loggedIn()) {
    echo "Hello ".$steam->personaname."!";
  } else {
    echo "<a href='".$steam->loginUrl()."'>Login</a>";
  }
?>

Planned

Nothing at the moment. Open an issue if you think there is something that could be better.

Data security

The library does not deliver safe/escaped data as it would limit the functionality. This will leave your site vulnerable to cross-site-scripting ("XSS") and SQL-injection attacks if you dont take actions to prevent them.

XSS

For example if a user calls himself <script src='http://example.com/hacks.js'></script> and you print that name to other users, their browser will download hacks.js.

You can prevent that by passing the string through htmlspecialchars($string).

SQL injection

For example if a user calls himself "; DROP TABLE *;-- and you directly execute that as an SQL-query, you will loose all your data.

You can prevent that by passing the strings through mysqli_escape_string($link, $string) or $mysqli->escape_string($string).

Legal stuff

If you choose to use the steam web-api you need to follow the Steam Web API Terms of Use found at http://steamcommunity.com/dev/apiterms

The marked code is taken from Syntax_Error's "Ultra Simple Steam-Login" Class found at http://forums.steampowered.com/forums/showthread.php?t=1430511 (Link is dead, archive version)

steamauthoop's People

Contributors

blackcetha avatar sheybey avatar vikas5914 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

steamauthoop's Issues

Demo.php redirect issues

Hello,
i have the following problem: When I want to try the demo and i try to log me in it Says Error! (http://prntscr.com/bond6u)
My Config:
"apikey" => "XXXXXXXXXXXXXXXXX",
"domainname" => "zwetschkenroester.li", // Displayed domain in the login-screen
"loginpage" => "var/www/html/demo.php", // path on my VPS (I also tried demo.php)
"logoutpage" => "",
"skipAPI" => false // true = dont get the data from steam, just return the steamid64

You can try it yourself: zwetschkenroester.li

LG
Sebastian

Login causes in White page

Hi,

maybe someone can help me out. If I try to login it will redirect me to the steam login page. This is normal but after logging in it´s redirect me back to the domain but now I have a white blank page.
I don´t know what I made wrong maybe someone had this error to and can help me out.

Thanks in advance

Kind regards
Thymopat

Trying demo.php

Hey!
Let's start with my first configuration of parameters. I have just added apikey and domainname like here:
"apikey" => "key",
"domainname" => "onetaptest.unaux.com",
Everything works fine except when I come back after logining in, nothing changed.
Next, when I add "loginpage" => "/index.php", on steam pops up the message "error"

Error with login->return

Hello,

I tested your code with mine.
The problem is that when this connection valid with steam, it does not redirect to my web space.

it tells me instead a simple message that says: error.
An idea on the ask ?

my allow_url_fopen is enabled and validated.

Thanks :)
Screen of the return value : http://prntscr.com/h61di2

Steam Login Session

I edited config and click the login text. After it returns to my web site but session not working.

              require("steamauthOOP.class.php");
              $steam = new SteamAuthOOP();
              if ($steam->loggedIn()) {
                echo $steam->personaname;
              } else {
                echo "<a href='".$steam->loginUrl()."'>Login</a>";
              } 

damo.php testen?!

Hallo,
ich wollte deinen Code mithilfe der demo.php testen. Ich habe dazu aber eine Frage: Was muss ich dann bei der Loginpage eintragen? Wenn ich es leer lasse gehts nicht und wenn ich demo.php eintrage gehts auch nicht!

LG

How to use url + parameters

Hi again,

I have the next problem.
If I try to login from example here:
domain.tld/profile.php?id=0123456789
than I will get a blank page, because there are no parameters.
I need the parameters to get the profile informations.
Ok I can make there an error page, but it´s poor for the people who log in.
How can I login with url + parmeters?

Thanks in advance
Kind Regards
Thymopat

Login Issue

Hi, I'm trying to use your API which is great, but there is a problem which I'm unable to sort out... When I try to login it will redirect me to the steam login page and after logging in it´s redirect me back but the problem now is that I have a white blank page. I'm not using any other additional functions or anything, just your original code used in 1 PHP file. (tried with separate same problems) The thing is I've tried in several other hosts and your API worked just fine, but in this host which I'm trying to use it won't work and I will be stuck on a blank white page and the Steam Key is fully registered to the website. I have live example here: http://echovalleyserver.com/e107_plugins/ipn_donate_menu/ipn_steam.php and the content of the ipn_steam.php file cant be found here: https://gist.github.com/SPooCK/08f1c97cf9b508ca72f9 I'm using e107 v2 hosted at https://hostmonster.com/ and not sure but maybe something is blocking it. Tried all possible access point which I can think of but no result. Maybe you can give me some light on this problem.

SSL error

http request doesnt work anymore or only for me. Check this out.

Cant get data then i changed line 101 from
.. file_get_contents("http://steamcommunity...
to
.. file_get_contents("https://steamcommunity...

Now, it works.

file get content convert to curl

I want to convert file_get_content to use curl under validate(). Can you suggest some example? I am getting error in this part as its returning null.

Steam login

Hi.
I have in the past the Steamauth by SmItH197, and now i am testing your login but this have the same problem sometimes, is not a open ID but you login and this bug on the process... You can see on csgotwo.com and test ...
Waiting for reply ;)
André Silva

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.