Member
Member
moconn   2006-11-22, 13:15
#1

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


Developer
Developer
trisweb   2006-11-22, 17:56
#2

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.

Member
Member
moconn   2006-11-23, 17:39
#3

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.
Member
Member
moconn   2006-11-27, 14:21
#4

Hi there,

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

Thanks a million!

Developer
Developer
trisweb   2006-11-28, 08:19
#5

Thought so. Glad you fixed it!

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.