Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing conditional on $_SERVER['HTTP_HOST'] in ExpressionEngine config file - not working
    primarykey
    data
    text
    <p>I am using ExpressionEngine 2 (build: 20101220) with Multisite Manager (v2.0 build: 20101215). I have one Main site and 30 subsites. I want users to be able to log in to any of the subsites and, at the same time, be logged in to the Main site. There is a way to do this so the user is logged in to all sites in the config file but the browser throws an error when it has do 30 redirects to set the cookies.</p> <p>So, I have created a conditional so that, based on which domain you are logging into, it will create the correct list for $config['multi_login_sites']:</p> <pre><code>$domain = $_SERVER['HTTP_HOST']; if ($domain == 'www.SiteB.com') { $config['multi_login_sites'] = "http://www.MainSite.com/|http://www.SiteB.com/"; } else { $config['multi_login_sites'] = "http://www.MainSite.com/"; } </code></pre> <p>I can display $config['multi_login_sites'] on the page and can see that when I'm on SiteB, it is correct. But when I log in, I get these errors and the redirect doesn't work:</p> <pre><code>A PHP Error was encountered Severity: Notice Message: Undefined index: 2 Filename: member/mod.member_auth.php Line Number: 243 A PHP Error was encountered Severity: Notice Message: Undefined index: 2 Filename: member/mod.member_auth.php Line Number: 244 </code></pre> <p>Those lines in mod.member_auth.php are the ones below that say 'redirect' and 'link':</p> <pre><code>// We're done. $data = array( 'title' =&gt; $this-&gt;EE-&gt;lang-&gt;line('mbr_login'), 'heading' =&gt; $this-&gt;EE-&gt;lang-&gt;line('thank_you'), 'content' =&gt; $this-&gt;EE-&gt;lang-&gt;line('mbr_you_are_logged_in'), 'redirect' =&gt; $sites[$this-&gt;EE-&gt;input-&gt;get('orig')], 'link' =&gt; array($sites[$this-&gt;EE-&gt;input-&gt;get('orig')], $this-&gt;EE-&gt;lang-&gt;line('back')) ); </code></pre> <p>If I get rid of the conditional statement and just use $config['multi_login_sites'] = "http://www.MainSite.com/|http://www.SiteB.com/"; then it works fine.</p> <p>It seems like this is a PHP issue but maybe it's an EE/CodeIgniter thing? Is there something I just don't know about using this type of variable in a conditional?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload