<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[PunBB Forums — External Login - How to get username, id, etc after login(COOKIE)?]]></title>
		<link>https://punbb.informer.com/forums/topic/24424/external-login-how-to-get-username-id-etc-after-logincookie/</link>
		<atom:link href="https://punbb.informer.com/forums/feed/rss/topic/24424/" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in External Login - How to get username, id, etc after login(COOKIE)?.]]></description>
		<lastBuildDate>Wed, 26 Oct 2011 11:27:14 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: External Login - How to get username, id, etc after login(COOKIE)?]]></title>
			<link>https://punbb.informer.com/forums/post/141692/#p141692</link>
			<description><![CDATA[<p>Instead of </p><div class="codebox"><pre><code>if ($forum_user[&#039;id&#039;] == &#039;1&#039;)</code></pre></div><p>Try using this instead:<br /></p><div class="codebox"><pre><code>if ($forum_user[&#039;is_guest&#039;])</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (the-golem)]]></author>
			<pubDate>Wed, 26 Oct 2011 11:27:14 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/141692/#p141692</guid>
		</item>
		<item>
			<title><![CDATA[Re: External Login - How to get username, id, etc after login(COOKIE)?]]></title>
			<link>https://punbb.informer.com/forums/post/141207/#p141207</link>
			<description><![CDATA[<p>Nice! Cross loggin solved <img src="https://punbb.informer.com/forums/img/smilies/smile.png" width="15" height="15" alt="smile" /> <br />i put this code into forum/login.php on line 114:<br /></p><div class="codebox"><pre><code>if($_POST[&#039;main_login&#039;] == 1)
        {
            redirect(&#039;http://XXXX.cz&#039;, $lang_login[&#039;Login redirect&#039;]);
        }
        else
        {
            redirect(forum_htmlencode($_POST[&#039;redirect_url&#039;]).((substr_count($_POST[&#039;redirect_url&#039;], &#039;?&#039;) == 1) ? &#039;&amp;amp;&#039; : &#039;?&#039;).&#039;login=1&#039;, $lang_login[&#039;Login redirect&#039;]);
        }</code></pre></div><p>and add one hidden input into my main login form.</p><p>I can loggin sucessfuly from forum page or main page. But at main page can get user status. Still getting username Guest and id 1 from $forum_user[&#039;username&#039;] and $forum_user[&#039;id&#039;].<br />Help pls.... <img src="https://punbb.informer.com/forums/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></description>
			<author><![CDATA[null@example.com (BigOHenry)]]></author>
			<pubDate>Fri, 16 Sep 2011 16:23:01 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/141207/#p141207</guid>
		</item>
		<item>
			<title><![CDATA[External Login - How to get username, id, etc after login(COOKIE)?]]></title>
			<link>https://punbb.informer.com/forums/post/141204/#p141204</link>
			<description><![CDATA[<p>Hello, i know, here is a lot of topics with external login or integration, but nothing works or nobody said this example works.<br />I need integrate external login (logout and registration) from my main page into forum. <br />adress: XXXXX.cz and forum is: forum.XXXXX.cz</p><p>external login script path: XXXXX.cz/site/login_gui.php<br />forum path: XXXXX.cz/subdom/forum/</p><p>1. Need to login into forum, but still need to stay on main page, not into forum<br />2. Need to be still logged when i will move from main page into forum and back</p><p>I have 2 parts of database. A) main database B) forum database...these databeses are connected only at user table.<br />When i will at main page, i will using only main database (A) + user table from forum database (B).</p><p>So i need to login first.<br />here is my external login script:<br /></p><div class="codebox"><pre><code>&lt;meta content=&quot;text/html; charset=utf-8&quot; http-equiv=&quot;Content-Type&quot; /&gt;
&lt;?php
 
// Add these lines in the very top of your code
define(&#039;FORUM_ROOT&#039;, &#039;subdom/forum/&#039;);
require FORUM_ROOT.&#039;include/common.php&#039;;

if ($forum_user[&#039;id&#039;] == &#039;1&#039;)
{
// Where will we go after login?
$forum_page[&#039;redirect_url&#039;] = &#039;http://www.XXXX.cz/&#039;;
 
$forum_page[&#039;form_action&#039;] = forum_link($forum_url[&#039;login&#039;]);
 
$forum_page[&#039;hidden_fields&#039;] = array(
    &#039;form_sent&#039;    =&gt; &#039;&lt;input type=&quot;hidden&quot; name=&quot;form_sent&quot; value=&quot;1&quot; /&gt;&#039;,
    &#039;redirect_url&#039;    =&gt; &#039;&lt;input type=&quot;hidden&quot; name=&quot;redirect_url&quot; value=&quot;&#039;.forum_htmlencode($forum_page[&#039;redirect_url&#039;]).&#039;&quot; /&gt;&#039;,
    &#039;csrf_token&#039;    =&gt; &#039;&lt;input type=&quot;hidden&quot; name=&quot;csrf_token&quot; value=&quot;&#039;.generate_form_token($forum_page[&#039;form_action&#039;]).&#039;&quot; /&gt;&#039;,
    &#039;main_login&#039;    =&gt; &#039;&lt;input type=&quot;hidden&quot; name=&quot;main_login&quot; value=&quot;1&quot; /&gt;&#039;

);
echo &quot;&quot;.$forum_user[&#039;username&#039;].&quot; &quot;.$forum_user[&#039;id&#039;].&quot;&quot;;

?&gt;
&lt;div id=&quot;container&quot;&gt;
  &lt;div id=&quot;topnav&quot; class=&quot;topnav&quot;&gt; &lt;a href=&quot;index.php?p=f_reg&quot; class=&quot;register&quot;&gt;&lt;span&gt;Registrovat&lt;/span&gt;&lt;/a&gt;&lt;a href=&quot;login&quot; class=&quot;signin&quot;&gt;&lt;span&gt;Přihlásit&lt;/span&gt;&lt;/a&gt; &lt;/div&gt;
  &lt;fieldset id=&quot;signin_menu&quot;&gt;
    &lt;form method=&quot;post&quot; id=&quot;signin&quot; action=&quot;&lt;?php echo $forum_page[&#039;form_action&#039;] ?&gt;&quot;&gt;
    &lt;?php echo implode(&quot;\n\t\t&quot;, $forum_page[&#039;hidden_fields&#039;]).&quot;\n&quot; ?&gt;
      &lt;label for=&quot;username&quot;&gt;Uživatelské jméno&lt;/label&gt;
      &lt;input id=&quot;username&quot; name=&quot;req_username&quot; value=&quot;&quot; title=&quot;username&quot; tabindex=&quot;4&quot; type=&quot;text&quot;/&gt;
      &lt;p&gt;
        &lt;label for=&quot;password1&quot;&gt;Heslo&lt;/label&gt;
        &lt;input id=&quot;password1&quot; name=&quot;req_password&quot; value=&quot;&quot; title=&quot;password1&quot; tabindex=&quot;5&quot; type=&quot;password&quot;/&gt;
      &lt;/p&gt;
      &lt;p class=&quot;remember&quot;&gt;
        &lt;input id=&quot;signin_submit&quot; value=&quot;Přihlásit&quot; tabindex=&quot;6&quot; name=&quot;login&quot; type=&quot;submit&quot;/&gt;
        &lt;input id=&quot;remember&quot; name=&quot;save_pass&quot; value=&quot;1&quot; tabindex=&quot;7&quot; type=&quot;checkbox&quot;/&gt;
        &lt;label for=&quot;remember&quot;&gt;Pamatovat přihlášení&lt;/label&gt;
      &lt;/p&gt;
      &lt;p class=&quot;forgot&quot;&gt; &lt;a href=&quot;#&quot; id=&quot;resend_password_link&quot;&gt;Zapoměli jste jméno nebo heslo?&lt;/a&gt; &lt;/p&gt;
    &lt;/form&gt;
  &lt;/fieldset&gt;
&lt;/div&gt;
&lt;?php 
}
else
{
        echo &quot;&lt;div id=\&quot;user_logged\&quot; &gt;&lt;p&gt;&quot;.
                            &quot;&lt;label&gt; Přihlášen: &quot;. $forum_user[&#039;username&#039;] .&quot;&lt;/label&gt;&quot;.            
                            &quot;&lt;input type=\&quot;button\&quot; alt=\&quot;Tlačítko Muj ucet\&quot; value=\&quot;Můj účet\&quot; onclick=\&quot;window.location.href=&#039;index.php?p=my_gui&#039;\&quot; /&gt;&quot;.
                            &quot;&lt;input type=\&quot;button\&quot; alt=\&quot;Tlačítko odhlásit\&quot; value=\&quot;Odhlásit\&quot; onclick=\&quot;window.location.href=&#039;index.php?p=logout&#039;\&quot;  /&gt;&quot;.    
                            &quot;&lt;/p&gt;&lt;/div&gt;&quot;;
                            

 } 

?&gt;</code></pre></div><p>When i loggin from external login. It said :<br /></p><div class="codebox"><pre><code>Probably you were logged in, but do not have cookies enabled. Change the settings so your browser so that cookies enabled for this site.</code></pre></div><p>and the adress is: XXXXX.cz/index.php?login=1</p><p>if i refresh page i am logged into forum, but i go back on main page i still see login form...</p><p>part of config.php <br /></p><div class="codebox"><pre><code>$cookie_domain = &#039;&#039;;
$cookie_path = &#039;/&#039;;</code></pre></div><p>Could anyone help me pls with this? using punBB 1.3.5</p>]]></description>
			<author><![CDATA[null@example.com (BigOHenry)]]></author>
			<pubDate>Fri, 16 Sep 2011 13:04:51 +0000</pubDate>
			<guid>https://punbb.informer.com/forums/post/141204/#p141204</guid>
		</item>
	</channel>
</rss>
