Advertisement
Guest User

steamauth.php

a guest
Jun 28th, 2015
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. <?php
  2. ob_start();
  3. if(!isset($_SESSION))
  4. {
  5. session_start();
  6. }
  7. require ('openid.php');
  8.  
  9. function logoutbutton() {
  10. echo "<form action=\"steamauth/logout.php\" method=\"post\"><input value=\"Logout\" type=\"submit\" /></form>"; //logout button
  11.  
  12. }
  13.  
  14. function steamlogin()
  15. {
  16. try {
  17. require("settings.php");
  18. $openid = new LightOpenID($steamauth['domainname']);
  19.  
  20. $button['small'] = "small";
  21. $button['large_no'] = "large_noborder";
  22. $button['large'] = "large_border";
  23. $button = $button[$steamauth['buttonstyle']];
  24.  
  25. if(!$openid->mode) {
  26. if(isset($_GET['login'])) {
  27. $openid->identity = 'http://steamcommunity.com/openid';
  28. header('Location: ' . $openid->authUrl());
  29. }
  30. echo "<form action=\"?login\" method=\"post\"> <input type=\"image\" src=\"http://cdn.steamcommunity.com/public/images/signinthroughsteam/sits_".$button.".png\"></form>";
  31. }
  32.  
  33. elseif($openid->mode == 'cancel') {
  34. echo 'User has canceled authentication!';
  35. } else {
  36. if($openid->validate()) {
  37. $id = $openid->identity;
  38. $ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
  39. preg_match($ptn, $id, $matches);
  40.  
  41. if(!isset($_SESSION))
  42. {
  43. session_start();
  44.  
  45. }
  46. $_SESSION['steamid'] = $matches[1];
  47. if (isset($steamauth['loginpage'])) {
  48. header('Location: '.$steamauth['loginpage']);
  49.  
  50.  
  51.  
  52. }
  53. } else {
  54. echo "User is not logged in.\n";
  55. }
  56.  
  57. }
  58. } catch(ErrorException $e) {
  59. echo $e->getMessage();
  60. }
  61. }
  62.  
  63. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement