Acces Gallery from 2 website

fauerskov
fauerskov's picture

Joined: 2007-11-02
Posts: 18
Posted: Wed, 2008-08-13 12:24

Hey

I need to acces one album in gallery from 2 website, I can find out who to do it

Because i have modifyet album.header to have a menu system, see www.vitapedersen.dk and clip on one album

In that menu I have a "Home" bottum, and I want to from album.header with web site the request i commin from, so I change "Home" to get back to the right web site

I have try to use <?php

session_id('GallerySession');
//Nu er sessionen åbnet og jeg kan tilføje/hente variabler ud af den
?>
and
<body>
<?
$_SESSION['program']= "WEBtest";

?>

But my variable WEBtest is not in album.header

So any one have a better idea

Best regards
Johannes

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Wed, 2008-08-13 12:36

Hello Johannes,

can you please explain a little more what you mean with "I need to acces one album in gallery from 2 website" ?

Jens
--
Last Gallery v1 Developer.
Tryout the TEST-Version of Gallery 1.6

 
fauerskov
fauerskov's picture

Joined: 2007-11-02
Posts: 18
Posted: Wed, 2008-08-13 13:03

Hello Jens

Yes, sorry if it was not clear.

I have a website www.vitapedersen.dk with gallery 1 installed and all albums, There is a special album on this webserver called
"Køkken Malerier" sorry for the danish text.

There is another website called www.kunstogmad.dk on this web site the is a menu called galleri, "With I now start website www.vitapedersen.dk in another windue"

I will start the album called "Køkken Malerier" from this website, an return to www.kunstogmad when I clip on Home.

The web site is now not on the same webserver, bute I will move them to another webserver with www.kunstogmad.dk as a snother domain on the same server.
Locatet in a subcirectory below www.vitapedersen.dk

I hope that explain what I want better

And thanks for quit reply

Best regards
Johannes

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Wed, 2008-08-13 14:05

Hi,

If the two domains are not hosted on the same Server, then $_SESSION can of course not work between the two domains.

What you can try to hack in is this:

Add a parameter in the link on the second domain.
Like: http://www.vitapedersen.dk/gallery/kokkenmalerier?domain=kunstogmad

In the Gallery catch this in init.php and set it in a session var.

if(!empty($_REQUEST['domain'])) {
    if($_REQUEST['domain'] == 'kunstogmad') {
        $_SESSION['domain'] = 'kunstogmad';
    }
    else {
        $_SESSION['domain'] = 'vitapedersen';
    }
}

if (!isset($_SESSION['domain'])) {
    $_SESSION['domain'] = 'vitapedersen';
}

In the navigation you can check the session and act accordingly.

This idea is just a quick hack and a first problem is that you would need to add the parameter in the first domain also.

Maybe using the referrer is better.

Jens
--
Last Gallery v1 Developer.
Tryout the TEST-Version of Gallery 1.6

 
fauerskov
fauerskov's picture

Joined: 2007-11-02
Posts: 18
Posted: Wed, 2008-08-13 18:53

Hi Jens

Thank's for quit reply, I will try that and let you know

My plan is to try Galley 1.6 when I have done these website for the customer, looking forward to check the new one

And also Gallery version 2, I have customer on this version to

Best regards
Johannes Fauerskov

 
fauerskov
fauerskov's picture

Joined: 2007-11-02
Posts: 18
Posted: Thu, 2008-08-14 18:56

Hi Jens

I have now done some testing with your code,
I have put the following into init.php

if(!empty($_REQUEST['domain'])) {
if($_REQUEST['domain'] == 'kunstogmad') {
$_SESSION['domain'] = 'kunstogmad';
}
else {
$_SESSION['domain'] = 'vitapedersen';
}
}
echo "CheckAA";
echo $_SESSION['domain'];
echo "CheckBB";

And when i called http://www.vitapedersen.dk/gallery/kokkenmalerier?domain=kunstogmad, from www.kunstogmad.dk

It print "CheckAA kunstogmad CheckBB" out with the echo statement, and then I put the following in top off album.header

echo "Check1";
echo $_SESSION['domain'];
echo "Check2";

It only print "Check1 Check2" , so the var domain was not transfer to album.header

Should I put somethink else i album.header. Could you give me some further info about what I have to do

Best Regards
Johannes

 
fauerskov
fauerskov's picture

Joined: 2007-11-02
Posts: 18
Posted: Fri, 2008-08-15 17:26

Hey

I got it to work now, Thanks

Best regards

Johannes Fauerskov

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Fri, 2008-08-15 19:53

:-)

What was the trick?

Jens
--
Last Gallery v1 Developer.
Tryout the TEST-Version of Gallery 1.6

 
fauerskov
fauerskov's picture

Joined: 2007-11-02
Posts: 18
Posted: Sat, 2008-08-16 10:38

Hi

I just moved you code to album.header.
It seems that the session info was not transfer from init.php to album.header.php
But now it works,

You can se it on my test web server.

www.kunstogmad.dk is on www.jfj2.dk
www.vitapedersen.dk is on www.jfj1.dk

I just have to finish the coding and upgrade to new version of gallery 1 before produktion
I can sent you album.header if you want, to share information

Thank for you help
Best regards

Johannes Fauerskov