1 gabriel1980 Nov 24, 2008 12:01
3 gabriel1980 Nov 26, 2008 23:28
¥åßßå wrote:
You need to check that the cookie path is "/" and that the cookie domain is ".domain.com" ... ish
Buggered if I can remember which /conf/ file it's in ... admin.php or advanced.php
I normally find it useful to change the cookie prefix ( same file ) at the same time to force evo to listen to my changes ;)
¥
Hi, Im back! :P Well, when I do the try to modify the advanced.php... I get a nice
Either you have not enabled cookies or this login window has expired.
What Ive done, was this: from conf/_advance.php, around line 309,
// ** Cookies **
/**
* This is the path that will be associated to cookies.
*
* That means cookies set by this b2evo install won't be seen outside of this path on the domain below.
*
* @global string Default: preg_replace( '#https?://[^/]+#', '', $baseurl )
*/
// $cookie_path = preg_replace( '#https?://[^/]+#', '', $baseurl ); /*OLD LINE*/
$cookie_path = '/'; /*NEW LINE*/
/**
* Cookie domain.
*
* That means cookies set by this b2evo install won't be seen outside of this domain.
*
* We'll take {@link $basehost} by default (the leading dot includes subdomains), but
* when there's no dot in it, at least Firefox will not set the cookie. The best
* example for having no dot in the host name is 'localhost', but it's the case for
* host names in an intranet also.
*
* Note: ".domain.com" cookies will be sent to sub.domain.com too.
* But, see http://www.faqs.org/rfcs/rfc2965:
* "If multiple cookies satisfy the criteria above, they are ordered in
* the Cookie header such that those with more specific Path attributes
* precede those with less specific. Ordering with respect to other
* attributes (e.g., Domain) is unspecified."
*
* @global string Default: ( strpos($basehost, '.') ) ? '.'. $basehost : '';
*/
if( strpos($basehost, '.') === false )
{ // localhost or windows machine name:
$cookie_domain = '';
}
elseif( preg_match( '~^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$~i', $basehost ) )
{ // Use the basehost as it is:
$cookie_domain = $basehost;
}
else
{
$cookie_domain = preg_replace( '/^(www\. )? (.+)$/xi', '.$2', $basehost );
// When hosting multiple domains (not just subdomains) on a single instance of b2evo,
// you may want to try this:
// $cookie_domain = '.'.$_SERVER['HTTP_HOST'];
// or this: -- Have a cookie domain of 2 levels only, base on current basehost.
// $cookie_domain = preg_replace( '/^( .* \. )? (.+? \. .+? )$/xi', '.$2', $basehost );
// fp> pb with domains like .co.uk !?
}
// echo $cookie_domain; /*OLD LINE*/
$cookie_domain = '.domain.com/blog1/'; /*NEW LINE*/
I also try to comment/uncomment the other options within the upper lines... and whats worse, I try to check out a 1.9.8 b2evo that works with flawless victories with the cookies... yet, the blue guy keeps eating my cookies! :P Where I still need to "do something"? (these things happen due not documentating things...)
4 yabba Nov 27, 2008 14:58
ok, you need something like :
$cookie_domain = '.domain.com';
$cookie_path = '/';
$instance_name = 'some_unique_name_with_no_spaces'; // forces a new cookie ;)
¥
5 gabriel1980 Nov 28, 2008 18:11
¥åßßå wrote:
ok, you need something like :
$cookie_domain = '.domain.com'; $cookie_path = '/'; $instance_name = 'some_unique_name_with_no_spaces'; // forces a new cookie ;)
¥
Yes, yes, I guess I get what you mean: the instance name is that thing upstairs the cookie section, that need to be changed in order to write properly the cookie (I wrote that thing, that also you explain me to reemplace in the lower part of the cookie section, abobe the time limit)
What Ive done (plus other "brute force" attepmpts that they dont even properly deliver the header!) was this:
// ** Cookies **
/**
* This is the path that will be associated to cookies.
*
* That means cookies set by this b2evo install won't be seen outside of this path on the domain below.
*
* @global string Default: preg_replace( '#https?://[^/]+#', '', $baseurl )
*/
// $cookie_path = preg_replace( '#https?://[^/]+#', '', $baseurl );
$cookie_path = '/'; /*the line you told me to add, I uncomment the previous line */
/**
* Cookie domain.
*
* That means cookies set by this b2evo install won't be seen outside of this domain.
*
* We'll take {@link $basehost} by default (the leading dot includes subdomains), but
* when there's no dot in it, at least Firefox will not set the cookie. The best
* example for having no dot in the host name is 'localhost', but it's the case for
* host names in an intranet also.
*
* Note: ".domain.com" cookies will be sent to sub.domain.com too.
* But, see http://www.faqs.org/rfcs/rfc2965:
* "If multiple cookies satisfy the criteria above, they are ordered in
* the Cookie header such that those with more specific Path attributes
* precede those with less specific. Ordering with respect to other
* attributes (e.g., Domain) is unspecified."
*
* @global string Default: ( strpos($basehost, '.') ) ? '.'. $basehost : '';
*/
if( strpos($basehost, '.') === false )
{ // localhost or windows machine name:
$cookie_domain = '';
}
elseif( preg_match( '~^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$~i', $basehost ) )
{ // Use the basehost as it is:
$cookie_domain = $basehost;
}
else
{
$cookie_domain = preg_replace( '/^(www\. )? (.+)$/xi', '.$2', $basehost );
// When hosting multiple domains (not just subdomains) on a single instance of b2evo,
// you may want to try this:
// $cookie_domain = '.'.$_SERVER['HTTP_HOST'];
// or this: -- Have a cookie domain of 2 levels only, base on current basehost.
// $cookie_domain = preg_replace( '/^( .* \. )? (.+? \. .+? )$/xi', '.$2', $basehost );
// fp> pb with domains like .co.uk !?
}
// echo $cookie_domain;
$cookie_domain = '.anydomain.com';
The thing is that as Im fooling arround with cookies, its kinda tedious to do attepmts, because I first try to erease the previous cookies (just in case...)
I also try to reemplace the whole cookie section with this:
$cookie_path = preg_replace( '#https?://[^/]+#', '', $baseurl );
$cookie_path = '/';
$cookie_domain = ( strpos($basehost, '.') ? '.'. $basehost : '' );
$cookie_domain = '.anydomain.com';
$cookie_state = 'cookie'.$instance_name.'state';
$cookie_name = 'cookie'.$instance_name.'name';
$cookie_email = 'cookie'.$instance_name.'email';
$cookie_url = 'cookie'.$instance_name.'url';
$cookie_session = 'cookie'.$instance_name.'session';
And guess what? It failed (this was what worked out in the previous b2evo installs) So as you see, Im trying to do my homeworkm but the cookie monster keeps eating them! (the best thing I could do is to deliver ONE cookie per domain... so I guess this is a thing about WHERE do you cut and paste properly the cookie domain: first, I do it with logic... and then I tried to do it just pasting it on illogic places!!!) So please, once again, if you could tell me wheres waldo... :D
6 gabriel1980 Nov 28, 2008 18:13
And whats most funny, is that the cookie section now is more commented, with some options commented to twist around... yet, now thats more documented, I fail... and in the past, when was less commented, I succeed! :P (thats whats desperating!!!)
7 gabriel1980 Dec 10, 2008 19:46
8 yabba Dec 10, 2008 20:10
ok, now that we've killed all the flowery descriptions ..... I'm still lost :D
Lets backup a smidge, because we must be missing summat, I have multi-domain blogs, all on the same server, all sharing the same folder, all sharing the same files ... although I've also had multi-domains, different servers, different folders, different files as well ...., all sharing same db, no fancy user table crap ... but had that in the past as well .... and, barring having to login to each root domain, my cookies work.
So, guess the questions are :
1) are we talkin' multi-domain or multi-sub-domain ... or both?
2) are all (sub)domains on the same server?
3) do they all share the same files or are they spread all over the place ( more config files to change ;) )
4) ..... urm ... gotta url to all these domains ( and pref an evo login that "fails" ) ?
¥
9 gabriel1980 Dec 10, 2008 20:28
1) Both! :P
2) So far, yes!
3) Ive got different lang installs (those are the different subdomain, subfolder, domains!) and they share the basic users files (so that way, theres just one user for all that madness!)
4) The thing is that right now, as that project was on delay, I start *trying* to slowly do a xhtml + css valid theme... so you might see stuff and dont see stuff! All this is because two lang subdomain, two subfolder blogs... all that in a domain, plus another domain!!! And the worst part... I did it work flawless in 1.9.8... in a few multilang installations!!! :P
PS1: Just for the record: I want to post in four langs, in two domain names, and all this is for rearrange the info in a sweet way! :P (I took the advantage of this weird ideas to my blog, in order to learn the b2evo a little bit more... Im still loss since the evolution!)
PS2: The idea is:
blabla.com/lang1blog1
blabla.com/lang2blog1
blabla.com/lang3blog1
lang1blog2.blabla.com/
lang2blog2.blabla.com/
lang3blog2.blabla.com/
blabla2.com/
blog2.blabla2.com/
So yes, its kinda messy! :P
10 austriaco Dec 11, 2008 00:05
The solution I found some time ago for multiple domains and subdomains, all residing in the same server is to set the cookie domain to the current host as determined by the HTTP request:
if( isset( $_SERVER['HTTP_HOST'] ) ) {
$cookie_domain = '.'.$_SERVER['HTTP_HOST'];
} else {
$cookie_domain = preg_replace( '/^(www\. )? (.+)$/xi', '.$2', $basehost );
}
This comes from my _advanced.php around line 341 and it has worked for me. I have a .com domain (which point to one b2evo blog) and .net domain (which point to another b2evo blog sharing th same DB) and another subdomain of the .net domain (which points to another blog on the same DB). This way I don't have problems logging in to any of the blogs. Hope this helps!
11 gabriel1980 Dec 14, 2008 13:21
Austriaco wrote:
The solution I found some time ago for multiple domains and subdomains, all residing in the same server is to set the cookie domain to the current host as determined by the HTTP request:
if( isset( $_SERVER['HTTP_HOST'] ) ) { $cookie_domain = '.'.$_SERVER['HTTP_HOST']; } else { $cookie_domain = preg_replace( '/^(www\. )? (.+)$/xi', '.$2', $basehost ); }
This comes from my _advanced.php around line 341 and it has worked for me. I have a .com domain (which point to one b2evo blog) and .net domain (which point to another b2evo blog sharing th same DB) and another subdomain of the .net domain (which points to another blog on the same DB). This way I don't have problems logging in to any of the blogs. Hope this helps!
Danke schön Austriaco! :D Well, I tried to cut & paste your lines of code, reemplacing statements, adding them... all at least twice, because I wanted to really test the dual log-in... and the very best I could get, was a dual login with php errors once! :P (seems to send twice headers... something that Im used to see, but on different situations!)
I did try your lines with "cookie path" with slash, without slash, with "cookie domain" here and there, uncommenting the suggestions that the b2evo had, leaving code, taking it out... and nothing! The weird thing, is that it was pretty straight forward this thing to be done with 1.9.x series... yet, the 2.x is a mistery unsolved to me! (Im still kinda lost in the 2.x, and as I dont have lots of time to investigate...) So if you could crudely cut & paste these lines (from the beggining of the cookie thing up to the end of the cookie thing!) I have a mental DDoS! :P
Now Im trying to solve by myself a htaccess rewritting that gaves me "issues" at the search box, the rss, and the next button... this cookie thing is pretty much a delicatessen, a classy thing I wanna do mostly coz I already done it!!! (hey, its also useful, as it annoys me A LOT to relog over and over again!!!) Gracias Austriaco! :D
PS: Searching out at your site, you already helped me out, with the 2.4.2 spanish translation! :D
12 gabriel1980 Dec 20, 2008 22:04
Well, finally, it worked out... as you said, those lines did the magic. My problem was... my $·%%$& ISP. The thing is that I was just up to do something, and first of all, I test it, just in case... and it worked out! The other day, the day I made the changes, it didnt. Why did happen this? Due the d*mn proxy cache, which interfires you when you surf the net! Argh!!! Anyway, in case anyone is reading this post, the whole lines that made this worked out was:
As Yabba said, around line 161:
$instance_name = 'PUTanythingWITHnoSPACES'
Then, around lines 296 and 345, put the lines Austriaco suggest, plus the cookie path Yabba said to add:
// ** Cookies **
/**
* This is the path that will be associated to cookies.
*
* That means cookies set by this b2evo install won't be seen outside of this path on the domain below.
*
* @global string Default: preg_replace( '#https?://[^/]+#', '', $baseurl )
*/
$cookie_path = '/';
/**
* Cookie domain.
*
* That means cookies set by this b2evo install won't be seen outside of this domain.
*
* We'll take {@link $basehost} by default (the leading dot includes subdomains), but
* when there's no dot in it, at least Firefox will not set the cookie. The best
* example for having no dot in the host name is 'localhost', but it's the case for
* host names in an intranet also.
*
* Note: ".domain.com" cookies will be sent to sub.domain.com too.
* But, see http://www.faqs.org/rfcs/rfc2965:
* "If multiple cookies satisfy the criteria above, they are ordered in
* the Cookie header such that those with more specific Path attributes
* precede those with less specific. Ordering with respect to other
* attributes (e.g., Domain) is unspecified."
*
* @global string Default: ( strpos($basehost, '.') ) ? '.'. $basehost : '';
*/
if( isset( $_SERVER['HTTP_HOST'] ) ) {
$cookie_domain = '.'.$_SERVER['HTTP_HOST'];
} else {
$cookie_domain = preg_replace( '/^(www\. )? (.+)$/xi', '.$2', $basehost );
}
/**#@+
* Names for cookies.
*/
// The following remember the comment meta data for non registered users:
$cookie_name = 'cookie'.$instance_name.'name';
$cookie_email = 'cookie'.$instance_name.'email';
$cookie_url = 'cookie'.$instance_name.'url';
// The following handles the session:
$cookie_session = 'cookie'.$instance_name.'session';
/**#@-*/
I leave the comments the b2vo had, just in case anyone is lost in translation and do not identify where the ·$·%$ lines are around! :P Thank you guys for helped me out! :D
You need to check that the cookie path is "/" and that the cookie domain is ".domain.com" ... ish
Buggered if I can remember which /conf/ file it's in ... admin.php or advanced.php
I normally find it useful to change the cookie prefix ( same file ) at the same time to force evo to listen to my changes ;)
¥