Quick Authentication

Posted by Brian Moon 
Quick Authentication
May 30, 2005 10:55AM
I had a need to check if someone was logged in via Phorum without all the heavy loading of all the Phorum code. This would be used to load the user's info on every page of a web site for example. There is no interface here to update the user info or anything. Just a script to check their cookie and load the user info in $USER. You will need your cookie's path set to / for this work across your site.

quick_auth.php (5.0)
quick_auth.php (5.1)
quick_auth.php (5.2)

Brian - Personal Blog



Edited 10 time(s). Last edit at 10/16/2007 09:07AM by brianlmoon.
Attachments:
open | download - quick_auth.php (1.2 KB)
open | download - quick_auth-5.2.php (2.1 KB)
Re: Quick Authentication
June 02, 2005 01:41PM
what would be an example of a general use for someth like this? perhaps integration with some other web app?
231
Re: Quick Authentication
June 02, 2005 02:59PM
sazaraki Wrote:
-------------------------------------------------------
> what would be an example of a general use for
> someth like this? perhaps integration with some
> other web app?


I have a big use of it. In fact, on my website, there is a challenge where users have to login on the forum to be able to try it out. For the moment, I simply use a little script that checks the cookie: it is VERY vulnerable! So this script is simply EXELLANT!
Thanks a lot brianlmoon ;)
Re: Quick Authentication
July 16, 2005 07:16PM
Hello Brianlmoon,

Can you explain how to run this option ?

We have to install mods and on each page we should make an include(?) ?

Thank you for your answer.
Re: Quick Authentication
August 16, 2005 11:27AM
This is a new version that fixes an issue with users with a space in their user name.

Brian - Personal Blog



Edited 1 time(s). Last edit at 08/17/2005 01:05PM by brianlmoon.
Re: Quick Authentication
August 16, 2005 04:31PM

Warning: Invalid argument supplied for foreach() in /home/lyruneda/public_html/test.php on line 19

Line 19:
foreach($USER["user_data"] as $key=>$data){

All I did was change mention of phorum in the board url path to the directory I named my phorum, but was I supposed to change anything else?

-------------------------------------------

"Everything we see or seem, is but a dream within a dream." -Edgar Allan Poe
Re: Quick Authentication
August 16, 2005 05:54PM
Asked Brian and he updated the script with a line that had been missing in the previous attachments. So to save him time of having to repost it, here it is.

-------------------------------------------

"Everything we see or seem, is but a dream within a dream." -Edgar Allan Poe
Attachments:
open | download - quick_auth.php (1.4 KB)
Re: Quick Authentication
August 17, 2005 10:26AM
Does anybody know how to alter this script into having an 'if logged in, echo username', 'if not logged in, echo 'not logged in''? Or would this be the wrong script to alter for that?

-------------------------------------------

"Everything we see or seem, is but a dream within a dream." -Edgar Allan Poe
Re: Quick Authentication
August 17, 2005 01:06PM
Well, once this script is in place, you will have a $USER variable that you can use anywhere you want.
if($USER["user_id"]){
    echo "logged in";
} else {
    echo "logged out";
}

Brian - Personal Blog
Re: Quick Authentication
September 09, 2005 11:42AM
Thank you for posting this Brian, it was just what I needed.
Custom user profile fields are also included in $USER in case anyone was wondering.

/\dam

--
My notable Phorum sites:
Movie Deaths Database - "review comments" system mostly powered by Phorum
Learn Chinese! - integrated forum quiz
Sorry, only registered users may post in this forum.

Click here to login