Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
Is there a way to prevent this other than removing links from the unregistered nav menu? People either click on a users name and view thier profiles or copy in the url for the who's online page and I would like to block them unless they are registered. TIA.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
https://www.ubbdev.com/forum/showflat...=true#Post73729

Same would apply to the profile page except I think you have to use $thisuser rather than $user on that page.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
[6.3.2]

online.php

find:
-----

Code
// -----------------<br />// Get the user info<br />   $userob = new user;<br />   $user = $userob -> authenticate("U_TimeOffset,U_Groups");


insert after:
-------------

Code
// Limit access to registered users.<br />   if (!$user['U_Username']) {<br />		$html = new html;<br />      $html -> not_right('You must be registered and logged in to perform this function.',$Cat);<br />   }


showprofile.php

find:
-----

Code
   $Username = $thisuser['U_Username'];<br /><br />   $html = new html;


insert after:
-------------

Code
// Limit access to registered users.<br />   if (!$Username) {<br />      $html -> not_right('You must be registered and logged in to perform this function.',$Cat);<br />   }


Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
Thanks guys, works great!

Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
A twist on this, can I make it to where a user has to be in a specific group to view these? I can see this as an incentive.

Sponsored Links
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
To require membership in group #5:

For online.php, change (referencing my previous post):

Code
if (!$user['U_Username']) {


to:

Code
if (!$user['U_Username'] or !strstr($user['U_Groups'], '-5-')) {


For showprofile.php, add U_Groups to the $userob->authenticate() call, and change:

Code
if (!$Username) {


to:

Code
if (!$Username or !strstr($user['U_Groups'], '-5-')) {


-----
Edit: Fixed above code. It incorrectly used "and" instead of "or".

Last edited by Dave_L; 09/10/2003 9:25 AM.
Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
excellent, thanks!

Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
This line doesn't appear to work for my online.php?

if (!$user['U_Username'] and !strstr($user['U_Groups'], '-10-')) {

It still restricts access for unregistered users and that's it, I created a group and did a query, the new group number is 10.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
My mistake. That should be "or", not "and". I've corrected my post above.

By the way, is your version 6.3.2? When dealing with this level of detail, you should always specify what version you're using.

Also, you didn't specify whether you want moderators and adminstrators to have access regardless of whether they're in group #10. If so, you'd have to add more stuff to the if-condition.

Joined: May 2003
Posts: 1,068
Junior Member
Junior Member
Offline
Joined: May 2003
Posts: 1,068
Okay, I am running 6.3.2 and yes I would like to allow mods and admins. Sorry for leaving that out.

Sponsored Links
Joined: Nov 2001
Posts: 126
Junior Member
Junior Member
Offline
Joined: Nov 2001
Posts: 126
Does this work for 6.4 as well?


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)