Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. <?php
  2. session_start();
  3. ob_start();
  4.  
  5. function logoutbutton() {
  6. echo "<form action='' method='get'><button name='logout' type='submit'>Logout</button></form>"; //logout button
  7. }
  8.  
  9. function loginbutton($buttonstyle = "square") {
  10. $button['rectangle'] = "01";
  11. $button['square'] = "02";
  12. $button = "<a href='?login'><img src='http".(isset($_SERVER['HTTPS']) ? "s" : "")."://steamcommunity-a.akamaihd.net/public/images/signinthroughsteam/sits_".$button[$buttonstyle].".png'></a>";
  13.  
  14. echo $button;
  15. }
  16.  
  17. if (isset($_GET['login'])){
  18. require 'openid.php';
  19. try {
  20. require 'SteamConfig.php';
  21. $openid = new LightOpenID($steamauth['domainname']);
  22.  
  23. if(!$openid->mode) {
  24. $openid->identity = 'http://steamcommunity.com/openid';
  25. header('Location: ' . $openid->authUrl());
  26. } elseif ($openid->mode == 'cancel') {
  27. echo 'User has canceled authentication!';
  28. } else {
  29. if($openid->validate()) {
  30. $id = $openid->identity;
  31. $ptn = "/^http:\/\/steamcommunity\.com\/openid\/id\/(7[0-9]{15,25}+)$/";
  32. preg_match($ptn, $id, $matches);
  33.  
  34. $_SESSION['steamid'] = $matches[1];
  35. if (!headers_sent()) {
  36. header('Location: '.$steamauth['loginpage']);
  37. exit;
  38. } else {
  39. ?>
  40. <script type="text/javascript">
  41. window.location.href="<?=$steamauth['loginpage']?>";
  42. </script>
  43. <noscript>
  44. <meta http-equiv="refresh" content="0;url=<?=$steamauth['loginpage']?>" />
  45. </noscript>
  46. <?php
  47. exit;
  48. }
  49. } else {
  50. echo "User is not logged in.\n";
  51. }
  52. }
  53. } catch(ErrorException $e) {
  54. echo $e->getMessage();
  55. }
  56. }
  57.  
  58. if (isset($_GET['logout'])){
  59. require 'SteamConfig.php';
  60. session_unset();
  61. session_destroy();
  62. header('Location: '.$steamauth['logoutpage']);
  63. exit;
  64. }
  65.  
  66. if (isset($_GET['update'])){
  67. unset($_SESSION['steam_uptodate']);
  68. require 'userInfo.php';
  69. header('Location: '.$_SERVER['PHP_SELF']);
  70. exit;
  71. }
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement