Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login system just like stackoverflow's, written in php

Tags:

php

oauth

openid

The question Is there a simple way to implement the login system that stackoverflow uses using php?

For a long time I have developed websites, and have used a typical web form username/password with a mysql db for login systems.

I would like to have it so users can log into the system using google, yahoo, facebook, etc, and without them having to remember some long openid url (they should just click google and be able to log in using their username/password there).

I would prefer not to use a service provider (such as RPX) to implement this.

like image 771
RobKohr Avatar asked Jun 01 '09 22:06

RobKohr


People also ask

How can I login as username in PHP?

php"); } // get current logged in user $logedInUsername = $_SESSION['user']; echo $logedInUsername; // check if the username is equal to admin if($logedInUsername == "admin") { echo "You are a admin!"; } else { echo "You are NOT a admin!"; } // End Require Login // ... html code below here ...

What is stack overflow in PHP?

Definition of PHP Stack Overflow. Stack Overflow in programming is a kind of error that can cause a serious issue to our program and make it even stop to respond as excepted. Stack Overflow is the same in every programming language and if we talk about PHP they also behave the same as expected.

What is a login php?

Php login script is used to provide the authentication for our web pages. the Script executes after submitting the user login button.


3 Answers

If you want to implement it yourself, here is a great walkthrough. There's also the PHP OpenID Library, but that's probably a lot more than you need.

Here is the client-side OpenID selector that SO uses on its login screen.

Edit: Stack Overflow no longer uses the one that I linked to, but it still works, as far as I'm aware.

like image 81
Sasha Chedygov Avatar answered Nov 10 '22 03:11

Sasha Chedygov


Check which pages clicking those buttons sends you to and then just redirect your users to those pages. They are all "openid" providers so you just need an open id library on your end to verify the response.

I use this one in PHP http://openidenabled.com/php-openid/. They have some good examples in that package to get you started.

like image 27
Paul Tarjan Avatar answered Nov 10 '22 04:11

Paul Tarjan


If you're looking at using preexisting code, the Zend Framework provides OpenID support. While the library itself is fairly large, you should be able to individual components in a relatively stand-alone way.

like image 26
Sean McSomething Avatar answered Nov 10 '22 03:11

Sean McSomething