Welcome to Geeklog, Anonymous Tuesday, June 06 2023 @ 07:59 pm EDT

Geeklog Forums

OT:: need a bit help


I hope you guys dont mind me asking for a little bit off help.. im tring to create a script for geeklog.. but.. how do i created the part were it checks to see if the users is logged in .. here is the code...---------------------------------------- <?php require_once('lib-common.php'); $Query = mysql_query("SELECT * FROM gl_users"Wink; if(uid == 'is_enabled'){ printf("Welcome %s ",mysql_result($Query,uid,"username"Wink); }else{ echo "you need to register first"; } ?> ------------------------------------------- i hope you dont mind me asking for a bit of help.. but i like to come to thoughs who knows the portal that im using.. thanx.. btw.. this script just picks a name and justs prints it out.. but i want it to.. only print out the user name that is logged in to the site.. and if they are not logged in then i want to send them to the loggin page.. (please help) thanx


How about if you use the function SEC_hasAccess located in /system/lib-security.php? If $uid > 1 then the person is logged in. Perhaps you might want to look at the external page plugin because it performs similiar (plus more) to what it seems that you want to do except it displays an error message instead of a login page. That should be fairly easy to modify. Your script though will only restrict pages it appears on. If you want all pages restricted, you probably have to play around with the loginrequired section in config.php. Plus every block, poll, and story submitted will need to have the anonymous block unchecked. You also would have to change some logic in GL to send the user to a login page instead of the current error message. If your site is on the internet, I hope you realize by restricting all access this way you also will be restricting any search engine spidering too.


thanx i got that part.. but.. one quesiton though.. if you dont mind.. im tring to send them to the part were it says.. you need to be logged in to use this feature.. how do i actualy get that.. (sorry just a newbie at php.. but learning fast =) )

Status: offline


Site Admin
Registered: 12/17/01
Posts: 405
Location:Urbandale, Iowa
This is a lot simpler than you have it. Just do this: require_once('lib-common.php'); if (!($_USER['uid'] > 1)) { // User not logged in } else { // User is logged in }---The reason people blame things on previous generations is that there's only one other choice.
The reason people blame things on previous generations is that there's only one other choice.

All times are EDT. The time is now 07:59 pm.

  • 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