Quick Authentication

Posted by Brian Moon 
Re: Quick Authentication
February 14, 2008 02:04PM
hello

I have problem

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /czarneplyty_strona/dupa.php on line 26

quick_auth.php 1.2 KB brianlmoon 12/04/2006

and sorry but main english is not good :(

i have phorum phorum-5.2.6a

hellp for me :)
Re: Quick Authentication
February 14, 2008 02:35PM
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
Re: Quick Authentication
February 15, 2008 02:18AM
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}
Re: Quick Authentication
February 15, 2008 02:49AM
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.:
<?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 sauce



Edited 1 time(s). Last edit at 02/15/2008 02:50AM by mmakaay.
Re: Quick Authentication
February 15, 2008 04:33AM
thx !! this working but I dont need header and footer :/



I need code which only this display

{IF LOGGEDIN}
Hello, {USER->display_name}!
{ELSE}
Hello, world!
{/IF}


On my other part



Edited 1 time(s). Last edit at 02/15/2008 05:51AM by re5pect.
Re: Quick Authentication
February 15, 2008 05:59AM
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):
<?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
I do not know I my friend sorry but this code does not act, "Hello, world!" shows all the time ... If I am logged or not
:(
Re: Quick Authentication
February 15, 2008 09:06AM
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
Re: Quick Authentication
August 10, 2008 11:53AM
Hi I don't really understand how to download this. Do you just download it to /mods? Thanks
Re: Quick Authentication
August 10, 2008 12:02PM
what are you trying to do? this script is not supposed to be run inside phorum but in another part of your page to check if a user is logged into phorum or not.


Thomas Seifert
Sorry, only registered users may post in this forum.

Click here to login