snipt

Ctrl+h for KB shortcuts

PHP

Zend Auth Custon namspace

1
2
3
4
5
6
7
8
//if you have multiple projects on the same host, you need to specify the zend auth session namespace

<?php
$this->auth = Zend_Auth::getInstance();
$this->auth->setStorage(new Zend_Auth_Storage_Session('Test_User'));
//if (!$this->auth->hasIdentity()) {
//    $this->_redirector->gotoUrl('/entry');
//}
https://snipt.net/embed/ea190294ff4856acef5b41f624aae57e/
/raw/ea190294ff4856acef5b41f624aae57e/
ea190294ff4856acef5b41f624aae57e
php
PHP
8
2019-08-20T23:36:53
True
False
False
Feb 06, 2013 at 03:09 AM
/api/public/snipt/55283/
zend-auth-custon-namspace
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a> <a href="#L-8">8</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">//if you have multiple projects on the same host, you need to specify the zend auth session namespace</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="cp">&lt;?php</span> </span><span id="L-4"><a name="L-4"></a><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">auth</span> <span class="o">=</span> <span class="nx">Zend_Auth</span><span class="o">::</span><span class="na">getInstance</span><span class="p">();</span> </span><span id="L-5"><a name="L-5"></a><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">auth</span><span class="o">-&gt;</span><span class="na">setStorage</span><span class="p">(</span><span class="k">new</span> <span class="nx">Zend_Auth_Storage_Session</span><span class="p">(</span><span class="s1">&#39;Test_User&#39;</span><span class="p">));</span> </span><span id="L-6"><a name="L-6"></a><span class="c1">//if (!$this-&gt;auth-&gt;hasIdentity()) {</span> </span><span id="L-7"><a name="L-7"></a><span class="c1">// $this-&gt;_redirector-&gt;gotoUrl(&#39;/entry&#39;);</span> </span><span id="L-8"><a name="L-8"></a><span class="c1">//}</span> </span></pre></div> </td></tr></table>
namespace, php, session, zend