A Cookie Path and an Idiot

trbailey
trbailey's picture

Joined: 2007-04-16
Posts: 172
Posted: Wed, 2008-02-06 15:46

Call me a dunce but I can't quite comprehend the cookie path setting and the blurb on the settings page is little help.

I have two separate galleries embedded within two separate wordpress sites. Neither gallery is in the wordpress directory tree.
../fga is the first gallery
../pga is the second gallery
www/home is the wordpress for /fga
www/trb is the wordpress for /pga

Both sites are defined under virtual server home.trbailey.net
What is the correct cookie path for this setup?
Do I need a cookie domain?

Author:Blog|Site

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2008-02-09 13:42

if it's your domain and you don't share it with anyone else, set the path to /

what are the URLs under which you access all the sites (WP / G2 standalone)?

and since you're talking about "first" and "second" gallery, are these separate installations? if so...they have nothing in common, they can't form a single-sign-on group and the cookie path needs to be configured separately.

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
trbailey
trbailey's picture

Joined: 2007-04-16
Posts: 172
Posted: Sat, 2008-02-09 16:52
valiant wrote:
if it's your domain and you don't share it with anyone else, set the path to /

The domain or the cookie path?

Quote:
what are the URLs under which you access all the sites (WP / G2 standalone)?

and since you're talking about "first" and "second" gallery, are these separate installations? if so...they have nothing in common, they can't form a single-sign-on group and the cookie path needs to be configured separately.

It may seem stupid but I don't have a clue what the cookie path is for and how the GALLERYSID works so this is partly a learning experience, as is my entire site, and my life for that matter.

I don't share a domain with anyone else.
Each installation is separate.
I'm not trying to combine them, thus they are completely separate installations. Eventually probably multisite. One is a family photo gallery, the other is my weblog.
Let's just focus on one setup, the other will be a duplicate theology.

My weblog is at:
http://home.trbailey.net/trb
It's path is: /var/www/trb
It's gallery is at:
http://home.trbailey.net/pga
it's path is: /var/www/pga

The issue is that I keep getting g2_GALLERYSID= in the URL's when I run isearch locally and I don't want them in the url since they bypass security, not to mention the SID will be wrong if I alter the URL from /isu to /home or /trb. I tried a multiroot view with an admin user using http authentication and I'm able to get the pages indexed OK. But, obviously the URL is wrong which I can correct with a bit of php legerdemain leaving the SID to deal with. Perhaps I can just remove it while I'm altering the URL?

Backing up a bit:
I want to be able to have a single search for my entire site. Wordpress has it' own search, gallery has it's own search. I tried to combine them using phpdig but it seems unstable and poorly written (php for document text parsing? Eeew). So, I tried isearch and it works OK when I set up a separate gallery root. I was thinking I could replace part of the URL and have a workable search that would jump to the login page if a url were selected that required it. But I can't get rid of the SID in the URL.

Is there some other way to deal with the issue of combined indexing?
Doesn't Apache have a mod_site_index? :)
Now that would be a neat project, and be a step towards a site owner indexing method that could then be linked to a SearchDNS server on the ISP and vuala, no more need to plug third party gadgets to get one's site indexed appropriately. Google indexes links, not content, something most people don't think about. While it's a bit beyond the topic, it provides the all-important context of the request.

Regardless, I still need to understand the SID and cookies as they relate to gallery.
-Tom

Author:Blog|Site

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Tue, 2008-02-12 10:41

trbailey,

Your site is down so I cannot see if you have the SID issue still, did you resolve it?

____________________________________
Wordpress / Gallery2 (WPG2) Plugin, , WPG2 Documentation, WPG2 Demo

 
trbailey
trbailey's picture

Joined: 2007-04-16
Posts: 172
Posted: Tue, 2008-02-12 19:07

I lost my internet this morning. Had to reset the modem.
The topic seems to be drifting with this post. Should I start a new thread for this topic in case others are interested. I'll eventually get this working and it will be very useful to be able to index beyond a wpg2 login using isearch.

Lemme get back to you on the SID issue for now, It's got to be related to the way isearch sees pages. I'm not going to use a multiroot view to try and spider the site. I'd have to change the url in the database to make it work. If I understand what the spider sees I won't need a separate view of the site.

Is there a document somewhere that describes, in detail, the cookie format and how wpg2 login works?

Here's the rub and what I've tried:
I need to be able to do a login for the spider engine. I pirated the wp-login code that does it but the spider still only sees public pages. I don't understand how it works so I'm a bit lost as to where to go next. The spider runs in a browser like any other php code. There is an option to run it from the command line and it works fine. I have it set to use curl to fetch pages. Using fopen fails for some reason, which might be a clue...?

What I did was copy this code from wp-login.php and edited it so it works standalone:

Quote:
<?php
require( '/var/www/home/wp-config.php' );

$user_login = '*****';
$user_pass = '********';
$using_cookie = FALSE;
if ( !$using_cookie )
$rememberme = TRUE;
wp_setcookie($user_login, $user_pass, false, '', '', $rememberme);
do_action('wp_login', $user_login);
//wp_safe_redirect($redirect_to);
//exit();
?>

Yes, I know it can be shortened to three lines, which I'll do later if it works.
Then in the spider reindex.php:

Quote:
<?php
// This section added to login to wordpress at /home for spidering
include ('/var/www/home/isearch2/admin/admin-wp-login.php');

And tried to add it to the top of the spider engine code block. I know the top code works, I can logout and use this code to log myself back into Wordpress. But the spider doesn't see what I see in my browser and I don't know why.
Help?
Author:Blog|Site

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Tue, 2008-02-12 21:44

WPG2 actually does not use the Wordpress Cookie, it grabs the current user session and passes along the user id to Gallery2. Gallery2 API has some excellent documentation -> http://codex.gallery2.org/Gallery2:Embedding:Integration.

In your case map the spider account to a G2 account and change the $user_ID in this line $ret = GalleryEmbed::checkActiveUser($user_ID) to that G2 Mapping.

____________________________________
Wordpress / Gallery2 (WPG2) Plugin, , WPG2 Documentation, WPG2 Demo