ZenphotoCMS Forum
Login Integration - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Login Integration (/thread-905.html)



Login Integration - moconn - 2006-11-22

Hi guys,

I wonder if you can help..

I am trying to allow seamless login from my main CMS (App 1) to zen photo.

Ideally once the user has logged into the main CMS they should not have to re-login to Zen Photo.

I can set it so both passwords are the same however how whenever I try to link to /zen/admin.php using the below script i get an error saying problem with login.

I am passing variables 'user', 'pass', 'redirect' and 'login' as you can see from my test script but still no joy..

Is there any special thing about zen photo admin page / login i need to know about?

Thanks for your help..


TEST CODE



END TEST CODE





Login Integration - trisweb - 2006-11-22

Okay, that won't work because you're loading it within PHP.... the cookie needs to be set on the user's system to work, so the [i]user[/i] has to load the url, not the server.

Take a look at /zen/auth-zp.php, it's short, sweet, well-documented and easy to read. Do what it does in reverse to set the "zenphoto_auth" cookie manually, that'd be my suggestion. You have to set the same $cookiepath, but that's all you have to get right essentially. The hash in the cookie is just md5($adminuser . $adminpass); (the dot is a concatenation). So all you have to do is this:

`$user = "username";

$pass = "password";

$cookiepath = "http://www.yoursite.com/zenphotodir"; // Same as WEBPATH

setcookie("zenphoto_auth", md5($user . $pass), time()+5184000, $cookiepath);`

Also note this only works if you're on the same domain as your ZP installation. Otherwise you'll need the user to load auth-zp.php somehow, maybe with a JavaScript call.




Login Integration - moconn - 2006-11-23

Ok,

Have spent a good few hours at this and still can't get it to work.

What's happening is as follows:

  1. When i process the login for my main CMS i have the following code.



Login Integration - moconn - 2006-11-27

Hi there,

Ok finally got it sorted was to do with the url path of the cookie..

Thanks a million!




Login Integration - trisweb - 2006-11-28

Thought so. Glad you fixed it!