SmItH197 / SteamAuthentication

A simple PHP Authentication that enables steam users to log into their steam account to access content!
MIT License
445 stars 145 forks source link

Redirect after successful login does not work. #68

Closed doZennn closed 9 years ago

doZennn commented 9 years ago

In the config file this does not do anything:

$steamauth['loginpage'] = "../logincheck/";
BlackCetha commented 9 years ago

You need to include steamauth before any text output.

doZennn commented 9 years ago

I have require 'steamauth/steamauth.php'; directly after my opening <?php tag if that's what you mean, it still dosen't work.

BlackCetha commented 9 years ago

Not only after your php tag. It needs to be infront of ANY text output like so:

<?php
include "steamauth.php";
?>
blablabla
<?php
more php code
?>
poespas commented 9 years ago

Wow! Blablabla!!! Keep up the good work! Op 13 jul. 2015 19:59 schreef "BlackCetha" notifications@github.com:

Not only after your php tag. It needs to be infront of ANY text output like so:

<?phpinclude "steamauth.php";?> blablabla<?phpmore php code?>

— Reply to this email directly or view it on GitHub https://github.com/SmItH197/SteamAuthentication/issues/68#issuecomment-121007152 .

BlackCetha commented 9 years ago

Are you serious? Where is this comment constructive and anywhere close to neccessary? Apart from that, it is just a sample text. I could replace it with "lorem ipsum" if you want.

doZennn commented 9 years ago

So that didn't work, so i made a small test site to make sure another part of my code wasn't interfering and its still not working. I'm still a bit new to PHP so perhaps you can take a look?

index.php

<?php require __DIR__ . '/steamauth/steamauth.php'; ?>
<!DOCTYPE html>
<html>
<head>
    <title>Test</title>
</head>
<body>
<?php 
if(!isset($_SESSION['steamid'])) {
            echo steamlogin();
        } else {
          include ('steamauth/userInfo.php');
            echo '<img src="' .$steamprofile['avatar']. '">';
            echo logoutbutton();
        }
?>
</body>
</html>

steamauth/settings.php

<?php
$steamauth['apikey'] = "REDACTED"; // Your Steam WebAPI-Key found at http://steamcommunity.com/dev/apikey
$steamauth['domainname'] = "localhost"; // The main URL of your website displayed in the login page
$steamauth['buttonstyle'] = "large_no"; // Style of the login button [small|large_no|large]
$steamauth['logoutpage'] = ""; // Page to redirect to after a successfull logout (from the directory the SteamAuth-folder is located in) - NO slash at the beginning!
$steamauth['loginpage'] = "../logincheck/"; // Page to redirect to after a successfull login (from the directory the SteamAuth-folder is located in) - NO slash at the beginning!

// System stuff
if (empty($steamauth['apikey'])) {die("<div style='display: block; width: 100%; background-color: red; text-align: center;'>SteamAuth:<br>Please supply an API-Key!</div>");}
if (empty($steamauth['domainname'])) {$steamauth['domainname'] = "localhost";}
if ($steamauth['buttonstyle'] != "small" and $steamauth['buttonstyle'] != "large") {$steamauth['buttonstyle'] = "large_no";}
?>

/logincheck/index.php

<?php
echo 'just work already';
BlackCetha commented 9 years ago

Try changing it to $steamauth['loginpage'] = "logincheck/";

doZennn commented 9 years ago

Tried that, Didn't work.

BlackCetha commented 9 years ago

Add me on steam and well get that sorted out. http://steamcommunity.com/id/blackcetha