-
Notifications
You must be signed in to change notification settings - Fork 140
Added support for passing _GET variables upon login #66
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
Conversation
You can actually use |
That's true, and more convenient. I didn't think about that. So the way of doing this would be, then: $vars = http_build_query(array('var1' => 'foo', 'var2' => 'bar'));
echo steamlogin($vars); |
Do that inside your function |
Okay, I've changed it. I've also updated the example file and the readme with the changes. |
One last thing, then were done: Its additional, not aditional. |
Sure thing. English is nor my first language, sorry. |
@@ -25,27 +25,53 @@ Add your API-Key from http://steamcommunity.com/dev/apikey | |||
|
|||
Now in your file add the following at the top: | |||
|
|||
<?php | |||
```php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a typo, it's the way of telling GitHub wich sintax will you be using for code highlighting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah thats github formatting, thought it was code and not the readme
Added support for passing _GET variables upon login
Hello again. I'm still developing my project wich I've uploaded to GitHub (in case you wanted to check it out if you were interested. And don't worry, I'll credit you when it's done :P). This time I needed to pass variables to be retrieved after the user logs in, and the framework currently didn't have support for that. So, I've added it, and I've uploaded it to my fork, in case you wanted to consider merging it. Here's how it works.
The
steamlogin()
function works as usual. The only change is that you now have to putecho
before calling it: the function itself won't echo the button anymore, you have to manually do it. Why? Felxibility. Sometimes you don't need the button to beecho
ed immediatly, but stored it in a variable to maybe pass it as a parameter to a method. For example, in my script I pass the button as a parameter to the methodModal::__construct()
. The class will create a Bootstrap Modal later, and include the button on it. Ifsteamlogin()
didecho
instead ofreturn
I'd need to modify my entire class; this way is much more convenient.So, any app that ran
steamlogin();
should now run
And now, the most important change. If you want to pass variables to be returned after the login, you'd do the following:
Notice that you don't have to put any
?
s and&
s at the beginning.In that case, you can use
$_GET['foo']
and$_GET['bar']
on your login page (set on the settings), and they will be set to1
and2
, respectively. Assuming that your return URL ishttp://website.com/index.php
, the user will be redirected tohttp://website.com/index.php?foo=1&bar=2
after loging in successfully on Steam.One last change: the line
session_start()
at line 37 on the old file was removed because it's already called at the beginning, so I believe that there's no point on calling it again (In fact, it gives you a warning)Thanks for your time, and have a nice day!