Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

steamauth.php need exit() after header #223

Open
corke opened this issue Jun 2, 2018 · 3 comments
Open

steamauth.php need exit() after header #223

corke opened this issue Jun 2, 2018 · 3 comments

Comments

@corke
Copy link

corke commented Jun 2, 2018

Hello guys !

I m using your component, it's was working well since today where I would like show my work and use the login steam, but this one doesnt want working like always, it's just redirect me on the site without doing the header to steam, after adding an exit(); after the header() that reworks fine, but I would like to understand why...

if (isset($_GET['login'])){
	require 'openid.php';
	try {
		require 'SteamConfig.php';
		$openid = new LightOpenID($steamauth['domainname']);
		
		if(!$openid->mode) {
			$openid->identity = 'https://steamcommunity.com/openid';
			echo "lol";
			echo $openid->identity;
			echo $openid->authUrl();
			header('Location: ' . $openid->authUrl());
			exit();
		} elseif ($openid->mode == 'cancel') {
			echo 'User has canceled authentication!';
		}

thanks

@BlackCetha
Copy link
Contributor

Are you overwriting the header somewhere later in your script?

@corke
Copy link
Author

corke commented Jun 5, 2018

Yes later in the code, I have an other header I used for recheck data.

  1. Login Steamauth =>Header : go on steam
  2. Back on mysite => Recheck => Header : refresh page

Something like this

@BlackCetha
Copy link
Contributor

BlackCetha commented Jun 5, 2018

In PHP, you set your HTTP header values by using the header() function. HTTP headers need to be sent before the payload, in your case probably HTML. PHP will accumulate the values you set for different headers and once you send content it will bundle them up and send them to the client first. After that, it is no longer possible to modify them. Additionally, only the last value set for a header is kept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants