snipt

Ctrl+h for KB shortcuts

PHP

Manual Logout Link for Joomla

1
2
3
4
5
6
7
<?php
	/*
    ** To create a manual logout link for Joomla, you must include the token or 
	** receive an "Invalid Token" error:
    */
    $logout = JRoute::_('index.php?option=com_users&task=user.logout').'&'.JUtility::getToken().'=1';
?>
https://snipt.net/embed/fcb1f3ffc20c5a376d5c5ff516feb6f4/
/raw/fcb1f3ffc20c5a376d5c5ff516feb6f4/
fcb1f3ffc20c5a376d5c5ff516feb6f4
php
PHP
7
2019-05-22T02:44:09
True
False
False
Dec 11, 2013 at 10:56 AM
/api/public/snipt/99871/
manual-logout-link-for-joomla
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="cp">&lt;?php</span> </span><span id="L-2"><a name="L-2"></a> <span class="cm">/*</span> </span><span id="L-3"><a name="L-3"></a><span class="cm"> ** To create a manual logout link for Joomla, you must include the token or </span> </span><span id="L-4"><a name="L-4"></a><span class="cm"> ** receive an &quot;Invalid Token&quot; error:</span> </span><span id="L-5"><a name="L-5"></a><span class="cm"> */</span> </span><span id="L-6"><a name="L-6"></a> <span class="nv">$logout</span> <span class="o">=</span> <span class="nx">JRoute</span><span class="o">::</span><span class="na">_</span><span class="p">(</span><span class="s1">&#39;index.php?option=com_users&amp;task=user.logout&#39;</span><span class="p">)</span><span class="o">.</span><span class="s1">&#39;&amp;&#39;</span><span class="o">.</span><span class="nx">JUtility</span><span class="o">::</span><span class="na">getToken</span><span class="p">()</span><span class="o">.</span><span class="s1">&#39;=1&#39;</span><span class="p">;</span> </span><span id="L-7"><a name="L-7"></a><span class="cp">?&gt;</span><span class="x"></span> </span></pre></div> </td></tr></table>
joomla, logout

Python

Django logout and redirect url.

url(r'^logout/$', 'django.contrib.auth.views.logout', {'next_page': '/'}),
https://snipt.net/embed/edcf9a4f64ef489e42e595a4a3538cec/
/raw/edcf9a4f64ef489e42e595a4a3538cec/
edcf9a4f64ef489e42e595a4a3538cec
python
Python
2
2019-05-13T10:27:23
True
False
False
Dec 04, 2013 at 11:51 AM
/api/public/snipt/98547/
django-logout-and-redirect-url
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="n">url</span><span class="p">(</span><span class="s1">r&#39;^logout/$&#39;</span><span class="p">,</span> <span class="s1">&#39;django.contrib.auth.views.logout&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;next_page&#39;</span><span class="p">:</span> <span class="s1">&#39;/&#39;</span><span class="p">}),</span> </span></pre></div> </td></tr></table>
django, logout

PHP

Joomla 1.7 logout button

1
2
3
4
5
<form action="<?php echo JRoute::_('index.php?option=com_users&amp;task=user.logout'); ?>" method="post">
<button type="submit" class="button"><?php echo JText::_('JLOGOUT'); ?></button>
<input type="hidden" name="return" value="<?php echo base64_encode($this->params->get('logout_redirect_url',$this->form->getValue('return'))); ?>" />
<?php echo JHtml::_('form.token'); ?>
</form>
https://snipt.net/embed/9ded1ae9dee73a4e23cb90823e3ed6f6/
/raw/9ded1ae9dee73a4e23cb90823e3ed6f6/
9ded1ae9dee73a4e23cb90823e3ed6f6
php
PHP
5
2019-05-10T17:20:38
True
False
False
Nov 14, 2012 at 02:31 AM
/api/public/snipt/34300/
joomla-17-logout-button
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="x">&lt;form action=&quot;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nx">JRoute</span><span class="o">::</span><span class="na">_</span><span class="p">(</span><span class="s1">&#39;index.php?option=com_users&amp;amp;task=user.logout&#39;</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x">&quot; method=&quot;post&quot;&gt;</span> </span><span id="L-2"><a name="L-2"></a><span class="x">&lt;button type=&quot;submit&quot; class=&quot;button&quot;&gt;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nx">JText</span><span class="o">::</span><span class="na">_</span><span class="p">(</span><span class="s1">&#39;JLOGOUT&#39;</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x">&lt;/button&gt;</span> </span><span id="L-3"><a name="L-3"></a><span class="x">&lt;input type=&quot;hidden&quot; name=&quot;return&quot; value=&quot;</span><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nb">base64_encode</span><span class="p">(</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">params</span><span class="o">-&gt;</span><span class="na">get</span><span class="p">(</span><span class="s1">&#39;logout_redirect_url&#39;</span><span class="p">,</span><span class="nv">$this</span><span class="o">-&gt;</span><span class="na">form</span><span class="o">-&gt;</span><span class="na">getValue</span><span class="p">(</span><span class="s1">&#39;return&#39;</span><span class="p">)));</span> <span class="cp">?&gt;</span><span class="x">&quot; /&gt;</span> </span><span id="L-4"><a name="L-4"></a><span class="cp">&lt;?php</span> <span class="k">echo</span> <span class="nx">JHtml</span><span class="o">::</span><span class="na">_</span><span class="p">(</span><span class="s1">&#39;form.token&#39;</span><span class="p">);</span> <span class="cp">?&gt;</span><span class="x"></span> </span><span id="L-5"><a name="L-5"></a><span class="x">&lt;/form&gt;</span> </span></pre></div> </td></tr></table>
button, joomla, logout