Quick Authentication
Posted by Brian Moon
|
Re: Quick Authentication February 14, 2008 02:04PM |
Registered: 18 years ago Posts: 14 |
|
Re: Quick Authentication February 14, 2008 02:35PM |
Admin Registered: 22 years ago Posts: 8,532 |
Are you using the script that is appropriate for your Phorum version? There are different versions of this script for 5.1 and 5.2.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: Quick Authentication February 15, 2008 02:18AM |
Registered: 18 years ago Posts: 14 |
OK , I understand, thx . But as make in order to display it code which is not on part in folder of forum ?
{IF LOGGEDIN}
{LANG->Welcome}
{USER->username}
<a href="{URL->REGISTERPROFILE}">{LANG->MyKonto}</a>
{IF ENABLE_PM}
<a class="link2" href="{URL->PM}">
{IF USER->new_private_messages}
<img border="0" src="templates/{TEMPLATE}/images/poczta2.gif">
{ELSE}
<img border="0" src="templates/{TEMPLATE}/images/poczta1.gif">
{/IF}
</a>
{/IF}
<a class="link2" href="{URL->LOGINOUT}">{LANG->LogOut}</a>
{ELSE}
{LANG->MyKonto}
<a class="link2" href="{URL->LOGINOUT}">{LANG->LogIn}</a>
<a class="link2" href="{URL->REGISTERPROFILE}">{LANG->Register}</a>
{/IF}
{IF LOGGEDIN}
{LANG->Welcome}
{USER->username}
<a href="{URL->REGISTERPROFILE}">{LANG->MyKonto}</a>
{IF ENABLE_PM}
<a class="link2" href="{URL->PM}">
{IF USER->new_private_messages}
<img border="0" src="templates/{TEMPLATE}/images/poczta2.gif">
{ELSE}
<img border="0" src="templates/{TEMPLATE}/images/poczta1.gif">
{/IF}
</a>
{/IF}
<a class="link2" href="{URL->LOGINOUT}">{LANG->LogOut}</a>
{ELSE}
{LANG->MyKonto}
<a class="link2" href="{URL->LOGINOUT}">{LANG->LogIn}</a>
<a class="link2" href="{URL->REGISTERPROFILE}">{LANG->Register}</a>
{/IF}
|
Re: Quick Authentication February 15, 2008 02:49AM |
Admin Registered: 22 years ago Posts: 8,532 |
You mean you want to use Phorum template code *outside* Phorum page? That will not work. The only way for that would be to fully build your site on top of Phorum. The most basic page could then be build from a php script, e.g.:
Inside the directory templates/yourtemplate/ you can then create my_page.tpl which contains your page's contents, e.g.:
phorum_output() will automatically display your page header and footer as well, so you do not have to put all the code from your posting in there. Only the real contents of the page. When doing things this way, you don't need the QA script, since you are actually writing new Phorum scripts which already know about the logged in user.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Edited 1 time(s). Last edit at 02/15/2008 02:50AM by mmakaay.
<?php
// In case you would put the script in the webroot and Phorum in a subdir.
chdir('./phorum');
// Load the Phorum code.
define('phorum_page', 'my_page');
include('common.php');
phorum_build_common_urls();
// You can setup some variables for the templates.
$PHORUM['TITLE'] = 'This is the title for the page';
$PHORUM['HTML_TITLE'] = 'This is the title that is shown in the page';
// ..etc..
// Display the template "my_page.tpl".
phorum_output('my_page');
?>
Inside the directory templates/yourtemplate/ you can then create my_page.tpl which contains your page's contents, e.g.:
{IF LOGGEDIN}
Hello, {USER->display_name}!
{ELSE}
Hello, world!
{/IF}
phorum_output() will automatically display your page header and footer as well, so you do not have to put all the code from your posting in there. Only the real contents of the page. When doing things this way, you don't need the QA script, since you are actually writing new Phorum scripts which already know about the logged in user.
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauceEdited 1 time(s). Last edit at 02/15/2008 02:50AM by mmakaay.
|
Re: Quick Authentication February 15, 2008 04:33AM |
Registered: 18 years ago Posts: 14 |
|
Re: Quick Authentication February 15, 2008 05:59AM |
Admin Registered: 22 years ago Posts: 8,532 |
That is a lot less that what you stated above. If it's only the hello part that you need, then after including the quick authentication code you can use something like this (untested code):
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
<?php
if ( isset($GLOBALS['USER']) && !empty($GLOBALS['USER']['user_id']) ) {
$display_name = htmlspecialchars($GLOBALS['USER']['display_name']);
print "Hello, $display_name!";
} else {
print "Hello, world!";
}
?>
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: Quick Authentication February 15, 2008 08:41AM |
Registered: 18 years ago Posts: 14 |
|
Re: Quick Authentication February 15, 2008 09:06AM |
Admin Registered: 22 years ago Posts: 8,532 |
This exact code works for me. I copied the 5.2 quick auth script and my propsed code, updated the path to Phorum and ran the script. It said "Hello, admin!" to me.
Check your browser to see if you have a cookie name "phorum_session_v5".
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
Check your browser to see if you have a cookie name "phorum_session_v5".
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: Quick Authentication August 10, 2008 11:53AM |
Registered: 18 years ago Posts: 95 |
|
Re: Quick Authentication August 10, 2008 12:02PM |
Admin Registered: 23 years ago Posts: 9,240 |
Sorry, only registered users may post in this forum.

