Single sign on in php

How to achieve single sign on using php? Can some one expain me in details?

You need to use either sessions or cookies. Here is a thread I started on the same topic: http://www.sitepoint.com/forums/showthread.php?t=646001

If you mean Single Sign-On in the true sense of the phrase, then take a look at [URL=“http://en.wikipedia.org/wiki/OAuth”]oAuth and [URL=“http://en.wikipedia.org/wiki/OpenID”]OpenID.

You cannot implement this with sessions or cookies, as these are tied to the creating domain.

That means if both the sites are hosted in same domain then we can do it using sessions or cookies. But what about the security?

If both sites are on the same domain then the easiest way is to use cookie. As far as security is concerned, it’s up to you how to implement it. You should make it so that password is not stored in cookie. Maybe you can store username and md5 hashed password + salt. That is easy enough to do.