Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 09:33 am EST

Geeklog Forums

Using Geeklog's username and password in other scripts


Giannis

Anonymous
Hi.
I am currently using geeklog as my main portal application, but have also installed a few third party scripts (noahs classified, etc).

Is it possible for all these other scripts to be able to use my geeklog's usernames and passwords - this way the user will only have to login once instead of logging in for each application seperatly.

Thanks
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Include lib-common.php in your scripts. This gives you access to all the current user's information (in the global $_USER array) as well as access to functions like SEC_inGroup to check group membership, etc.

bye, Dirk
 Quote

Giannis

Anonymous
Hi Dirk,

Thanks for the information. However, I'm not that familiar with php (starter) so what do I do then - where do I insert this file? What changes have to be made.

You help is much appreciated

Thanks
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Well, some PHP (basic) knowledge would help when you want to modify PHP scripts ...

Include the lib-common.php using require_once:
Text Formatted Code
require_once ('lib-common.php');
 
(add the path, if necessary). Then you have a global array named $_USER (need to declare this as global $_USER; when used within a function). If $_USER['uid'] is greater than 1, then the current user is logged in. Something like
Text Formatted Code
if (isset ($_USER['uid']) && ($_USER['uid'] > 1)) {
    // user is logged in
} else {
    // the current user is an anonymous user
}
 

HTH

bye, Dirk
 Quote

All times are EST. The time is now 09:33 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content