You are not logged in.
CeBe wrote:
a clean way to determine whether the admin path is www.example.com/admin/ or admin.example.com or www.example.com/textpattern/
It’s not exactly what I’d call clean but the split and hope method is the closest I’ve found to a solution:
// Test array. Add test cases here... $url = array( 'http://www.example.com/admin/', 'http://www.example.com/textpattern/', 'https://www.example.com/admin/', 'www.example.com/admin/', 'example.com/admin/', 'example.com/textpattern/', 'admin.example.com', ); dmp($url);foreach ($url as $link) { // Remove protocol because the optional slashes get in the way of finding the domain $link = str_replace(array('http://', 'https://', 'ftp://'), '', $link);// Splittah! $parts = do_list($link, '/'); $domain = array_shift($parts); $admin_subdir = isset($parts[0]) ? $parts[0] : ''; dmp($admin_subdir); }
Note that the final subdomain example identifies the admin subdir as '' because you’d set your site_url up to match the subdomain… at least I hope that’s the case!
Totally untested and most likely there are corner cases where it’d fail, or it may be completely unsuitable. Discuss :-)
Last edited by Bloke (2012-03-28 15:53:52)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern.
Txp Builders – finely-crafted code, design and Txp
Offline
planeth a écrit:
Would it be too much of a hassle/not txply correct to add path/to/admin in prefs ?
For future releases, it would be lovely :) Feature request ?
Right now we have to do with what we have (or don’t). What about this :
// First determine possible admin URLs // (do it here) // should give the following array, order is important :$url = array( 'www.example.com/admin' // or 'example.com/admin', depending on preferences , 'www.example.com/textpattern' // ditto , 'admin.example.com' ) ;foreach( $url as $link ) { $headers = @get_headers( $adm_url = PROTOCOL . $link . '/' ) ; if( $headers !== false && strpos( $headers[ 0 ], '404' ) === false ) break ; }// got it in $adm_url
Fully untested neither, it’s just an idea.
Last edited by CeBe (2012-03-28 21:54:38)
Offline
AFAIK, that seems smart :)
The one problematic point is if you got an admin url like www.example.com/my-funky-unguessable-admin-name …
But since the wiki way for multi-site is admin for url, not many people will change for another name. Though it might be a wise move from a security point of vue.
My 2 cents !
Offline
Hi claire
it seems a little bug in your code (9.1)
when i use cbe_login_with value=“email” there something showing on top of the page “array(login=“with” ! i thinked it s due to testing mode of textpattern but even on live mode it not disapear.
Cheers
Offline
Dragondz a écrit:
there something showing on top of the page
Ahem… Removed a parasitic var_dump in 0.9.2.
Thank you, and sorry.
Offline
Hello Claire,
This is an awesome plugin! I’m testing it out for the first time (along with cbe_members, smd_bio and smd_user_manager). Sometimes I login and then navigate to another page/section and I’m logged out unexpectedly (the login form shows up again). Other times, I login and everything works as it should. It is very unpredictable – happens on different pages and with different users. This has happened both on Chrome and Safari. Here is a link to my test site: http://photonomad.com/treetest/
Two sample logins (no back end privileges) are:
name: msue pw: password
name: msmith pw: password
Any ideas as to what is happening?
Thanks,
Stacey
Offline
Any change you are trying to log in with the same account to admin-side too, or you are logged in with same user in multiple browsers? In either of those scenarios, you would thrown out. Single account can only be used in single client instance.
As the test site goes, I personally see no issues. Logging in works fine, cookies are created properly, it updates session hashes and so on. Nothing out of the ordinary.
Rah-plugins | What? I’m a little confused… again :-) <txp:is_god />
Offline
photonomad a écrit:
Sometimes I login and then navigate to another page/section and I’m logged out unexpectedly (the login form shows up again). Other times, I login and everything works as it should.
That’s because sometimes the URL is with www (http://www.photonomad.com), sometimes without (http://photonomad.com), these are two different domains and two different sets of cookies.
Back to the help file and read the Quick start paragraph :)
Offline