ratthing

How can a

PHP

  script access all the cookies for a given domain's paths?  I'm working on my test LAMP box, and have a set of scripts to set a cookie for the "/" directory.  I also would like to add a checkto see if there's a cookie for a WP user active.  The blog is under the directory, "blog".  Barebones code to try to see the WP cookies:
<?

php

 
error_reporting(E_ALL);
//start a session
session_name("cookiechk");
session_start("cookiechk");
$blog = "/blog/";
print '<pre>'; var_dump($_SERVER['HTTP_COOKIE']); print '</pre>';
?>

As a test, I log into my WP blog on the test box, verify the cookies are there (two WP session cookies, plus the logged in user cookie), then hit my script above in another tab. All I get back when the script runs is the session cookie for the "cookiechk" session.

Should I just be trying to retrieve the WP cookie directly instead?  I saw nothing in the

PHP

  docs that referenced retrieving/viewing cookies by path.

Cluebats appreciated--
=RT=

ratthing

Answering my own question here... Applause

Seems like you can only see cookies at your script's current path level and above, not parallel to your path.  I'll either have to add a bit of code to WP to create another cookie at the root level which my script can see, or skip the script check and have mod_rewrite do the check.

Have I mentioned I hate mod_rewrite.  It would ap

pear

  I am going to continue to suffer it's horrors.
=RT=

perkiset

mod_rewrite is ugly as sin, but simply shithot. Ping more if'n you be having difficulties...

ratthing

I appreciate the offer, Perk.  Every time I think I'm starting to wrap my brain around mod_rewrite and actually grokking it, I read/see/test something else, and that brief glimpse of the light bulb shatters.  But I keep muddling through.  I have to say that jdMorgan over at webmaster world is <>the shizzle when it comes to mod_rewrite.  He knows his stuff.

=RT=

ratthing

So, I spun my wheels and got my mod_rewrites working on my dev server.  Copacetic.  I upload everything to my shared host (cPanel), none of the fscking stuff worked.  I fiddled with rewrite rules until I was cross-eyed, but never got it working.  I can only presume there's some sort of globals in the httpd.conf + the named virtual hosts directives that stomp my rewrite rules.  With no rewrite logging available, it's just guesswork, too.  One more chalk mark in the pro column for VPS.

I ended up putting a check in the header.

php

  for the blog.  A kludge, since I may put up more apps under the domain later, but as BH

SEO

  says, "Just fscking do it!" 80/20 and all that.

I put in a request to my host for my virtual host section of the httpd.conf, we'll see if they give it to me.

=RT=


Perkiset's Place Home   Politics @ Perkiset's