#1 June 26, 2018 7:44pm

redm33
Member
Registered: December 19, 2017
Posts: 7

Check Admin Login on Main Site

Is there a way to check if I'm logged into the admin site on the main site (the entire main site)? I was able to check if an admin cookie is set ($_COOKIE["bigtree_admin"]["email"])  but it only works on the home page for some reason; I could very well be doing something wrong... I'm trying to add functionality on the main site that you can only do if you are logged into the admin site.  Hopefully that makes sense!

Thanks!

Offline

#2 June 27, 2018 8:10am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Check Admin Login on Main Site

It's possible that the "domain" in your environment.php file is set incorrectly. That will cause your login cookie to be scoped improperly and not available on all pages of your site.

Offline

#3 June 29, 2018 10:12am

redm33
Member
Registered: December 19, 2017
Posts: 7

Re: Check Admin Login on Main Site

It appears as though when I login through the admin and view the site it wipes out the www from the URL. Then the cookie appears true. I tried updating my config.environment.php to include the www in the domian, www_root, and admin_root but it still wipes it from the URL every time I login to the admin.

If I go to the admin URL using www, it removes it. Then I can add it too the URL and it stays and I can login but upon being directed to the dashboard, it removes the www again from the URL. If I try to then add it in the URL on the dashboard link, it redirects me back to the login screen without the www in the URL. Hopefully that makes sense...

I would really like everything to have a leading www in the url if possible.

Thank you!

Offline

#4 June 29, 2018 10:23am

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Check Admin Login on Main Site

It sounds like it's possible that you have an .htaccess rule that is stripping the www from your hostname when accessing the site with www. in the domain.

Offline

#5 June 29, 2018 11:12am

redm33
Member
Registered: December 19, 2017
Posts: 7

Re: Check Admin Login on Main Site

Upon digging into my .htaccess file. I can't find anything that would strip the www from the admin site.

This is at /site:

IndexIgnore */*

Options -MultiViews

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?bigtree_htaccess_url=$1 [QSA,L]


RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
RewriteRule .* - [E=HTTP_BIGTREE_PARTIAL:%{HTTP:BigTree-Partial}]

It's only the admin site where this occurs. The main site keeps the www just fine. Also I should note, the cookie noted above DOES NOT register as set on the home page when the www is present, so you are correct in that it is the domain name (mainly the absence of the www).

Offline

#6 June 29, 2018 11:19am

redm33
Member
Registered: December 19, 2017
Posts: 7

Re: Check Admin Login on Main Site

Shoot....I was editing the wrong environment file. Everything appears to be working now smile Thank you for your help!

Offline

#7 June 29, 2018 12:52pm

timbuckingham
Administrator
From: Baltimore, MD
Registered: April 2, 2012
Posts: 974

Re: Check Admin Login on Main Site

Glad you got everything worked out!

Offline

Board footer

Powered by FluxBB

The Discussion Forum is not available on displays of this size.