SmItH197 / SteamAuthentication

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

mysql help #96

Closed EnergyFall closed 8 years ago

EnergyFall commented 8 years ago

I need some help to connect php with my database and upload info from the php to the database! I'm still learning :)

SmItH197 commented 8 years ago

http://php.net/manual/en/book.mysqli.php

SmItH197 commented 8 years ago

Have you tried anything? Any errors? Any code you can show?

EnergyFall commented 8 years ago

I havent tried anything yet because i dont know where to put the code xD

SmItH197 commented 8 years ago

The if($openid->validate()) function in steamauth.php line 32. I would put it after the steam session is created and before the redirect (around line 37)

EnergyFall commented 8 years ago

How do i get the profile pic and name to show when they log in?

bman46 commented 8 years ago

Look at the demo.php file for showing there icon. I wouldn't recommend saving it to a DB because it can consume a lot of space unless ur only using it temporarily

bman46 commented 8 years ago

Also, here is another url on MySQL DB and php: http://www.w3schools.com/php/php_ref_mysqli.asp

BlackCetha commented 8 years ago

There is nothing wrong with saving the URL of the avatar to the database.

bman46 commented 8 years ago

@BlackCetha oh, i though he meant the entire image (face palm)

bman46 commented 8 years ago

also, visit issue #86 I posted a entire thing about it on there and it may help

bman46 commented 8 years ago

To get there image you could

bman46 commented 8 years ago

Use there IP to link the image address to it In a DB and then when someone goes on ur website it checks to see if there IP was saved and if it was it gets the image and puts it where u need it, and if not it ask you to sign in and then gets all of the data

Gummibeer commented 8 years ago

@bman46 saving the IP for authentication isn't good - better is to create a session or crypted cookie and use this. On most private PCs the IP get changed around midnight cause of a force disconnect of the provider. And the IP is the easiest thing to fake with a faked header, a proxy or just don't send it.

The best way would be to save the url in any table/columns related to the user model and if the authentication of the app was successfull then you can grab the url out of the DB.

bman46 commented 8 years ago

good point @Gummibeer https://github.com/Gummibeer, but with Comcast and Verizon (I have had the both) it normally get changed when you unplug the router, and if it does not change for a week or so that is better then having to sign in every time you open your browser. But i could see this being a issue with network switches and stuff like that.

Gummibeer commented 8 years ago

@bman46 For this reason you can use cookies or sessions with a defined lifetime (1day, 1 week, 1month, 1year, whatever you want) it's the same like "all" other sites (facebook, google, amazon, github, paypal ...) are doing it. With more or less other security parts but never by ip. Cause next day another one will have your IP he visit the site and is logged in with your account!? The IP-Address is good/ok for logging, geolocation and other not security related things.

bman46 commented 8 years ago

Code example plz

Gummibeer commented 8 years ago

setting up session data: http://php.net/manual/de/function.session-start.php setting up cookie data: http://php.net/manual/de/function.setcookie.php getting geo data by ip: http://maxmind.github.io/GeoIP2-php logging in php: https://github.com/Seldaek/monolog combining everything in an easy to use framework: https://laravel.com Any more open questions?

bman46 commented 8 years ago

K Thq

Sent from my iPhone

On Mar 11, 2016, at 8:46 AM, Tom Witkowski notifications@github.com wrote:

setting up session data: http://php.net/manual/de/function.session-start.php setting up cookie data: http://php.net/manual/de/function.setcookie.php getting geo data by ip: http://maxmind.github.io/GeoIP2-php logging in php: https://github.com/Seldaek/monolog combining everything in an easy to use framework: https://laravel.com Any more open questions?

— Reply to this email directly or view it on GitHub.

SmItH197 commented 8 years ago

Gonna close this now, don't really see the point in keeping this open.

bman46 commented 8 years ago

K