php forum
php mysql forum
php mysql smarty
 
Page 2 of 3 < 1 2 3 >
Topic Options
#315167 - 08/11/07 10:46 PM Re: User Authentication Class [Re: Ian Spence]
Gizmo Administrator Offline
Wizard

Registered: 01/10/00
Posts: 5134
Loc: Portland, OR, USA
Originally Posted By: Ian Spence
The constructor didn't get renamed when I renamed the class. I can't wait until Threads stops supporting PHP 4.X
Talked to Rick about that, he said that anything like that would be far off smirk
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design Owner

Top
#315182 - 08/13/07 12:20 AM Re: User Authentication Class [Re: Gizmo]
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25452
Loc: Texas
Not much after Dec 31, eh? wink
_________________________
- Allen wavey
- What Drives You?

Top
#315230 - 08/16/07 03:15 PM Re: User Authentication Class [Re: AllenAyres]
Mark_S Offline
Power User

Registered: 11/15/03
Posts: 85
Loc: UK
Originally Posted By: Ian Spence
Find:
Code:
function UserAuth() {


Replace with:
Code:
function user_auth() {


The constructor didn't get renamed when I renamed the class. I can't wait until Threads stops supporting PHP 4.X


Done but still not working. ??

Snip it from the includes file.
Php Code:


class user_auth {
	var $fields;
	var $is_logged_in;
	var $permissions;
	var $is_banned;
	var $groups;

	function user_auth() {
		global $config, $dbh;

		// First, the stupid stuff we do in every constructor


 


My page is test.php
Php Code:

<?php
include ('/home/xxxxx/domains/xxxxxxxxx/public_html/forums/includes/user_auth.inc.php');

// Want to create a welcome message? 
if( $userob->is_logged_in ) { if( $userob->is_banned ) { echo "Go away, " . $userob->fields['USER_DISPLAY_NAME']; } else { echo "Welcome, " . $userob->fields['USER_DISPLAY_NAME']; } } else { echo "Please register<br />"; } 
echo "Script has ran. <br />";
?>



1. I am logged into my forums
2. Output = "Please register"
3. No errors out put ??

I cant understand what's wrong?

Its there a die script i can do for the sql?
To see where its failing??

Thanks for the help and assistance as always. wink

Top
#315231 - 08/16/07 03:23 PM Re: User Authentication Class [Re: Mark_S]
sirdude Moderator Offline
Enthusiast

Registered: 11/08/03
Posts: 442
Loc: SoCal
$userob = new user_auth();

needs to be there, before you can start using the class.. :2c:

Php Code:



<?php
include ('../libs/forums/includes/user_auth.inc.php');

// Instantiate the user auth class as muhaha, for example
$muhaha = new user_auth();	 // w00t, yah baby :rawk:

// Want to create a welcome message? 
if( $muhaha->is_logged_in ) { 
  if( $muhaha->is_banned ) { 
	echo "*cough* be gone, " . $muhaha->fields['USER_DISPLAY_NAME']; 
  } 
else { 
  echo "Waaazzaaaap, " . $muhaha->fields['USER_DISPLAY_NAME']; 
  } 
} else { echo "Please register<br />"; 
  } 
echo "Veni, vidi, vici!! <br />";
?>



of course, use 'userob' for your case. i just kinda like 'muhaha' laugh

Top
#315285 - 08/19/07 04:13 AM Re: User Authentication Class [Re: sirdude]
Mark_S Offline
Power User

Registered: 11/15/03
Posts: 85
Loc: UK
Sweet that works wink

Thanks for getting back smile

looks like i was missing the

$muhaha = new user_auth(); // w00t, yah baby :rawk:
in my protected page wink

Thanks again.
i laughed at the outputs lol

Top
#316733 - 02/19/08 02:39 PM Re: User Authentication Class [Re: Mark_S]
Mark_S Offline
Power User

Registered: 11/15/03
Posts: 85
Loc: UK
Will this work in 7.3 ??

Top
#316842 - 04/07/08 03:31 AM Chat Profile:Need convert user_name to user_number [Re: Mark_S]
curiousguy Offline
Newbie

Registered: 02/20/08
Posts: 10
For chat integration, the chat should be able to call up the ubb profile of a user.

This is complicated by the fact that these are not organized by user name but by number.

Can you please post a conversion routine from user name to user number?
Or a routine that outputs the profile but uses user name as input?
Or even better, both of the above?


I post this here in the midst of this thread, as this is intrinsically related to user authentication, and actually a by-product of the user authentication code. Whoever needs user authentication for an external product like a chat could use a user profile link.

And like Mark_S, I am curious if all this will work for 7.3

Thank you


Top
#316843 - 04/07/08 11:38 AM Re: Chat Profile:Need convert user_name to user_number [Re: curiousguy]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 304
Loc: The Netherlands
This works in 7.3, except for the permission reading stuff. That has changed. If you need that, like I do, this script would have to be updated.

A query that gets a username if you only have a number is easy.

Code:
select ubbt_USER_DISPLAY_NAME from ubbt_USERS where USER_ID = 50
_________________________

Top
#316846 - 04/08/08 09:09 AM Re: Chat Profile:Need convert user_name to user_number [Re: blaaskaak]
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25452
Loc: Texas
Thanks Yarp! smile
_________________________
- Allen wavey
- What Drives You?

Top
#316955 - 05/12/08 07:46 AM Re: Chat Profile:Need convert user_name to user_number [Re: blaaskaak]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 304
Loc: The Netherlands
Originally Posted By: blaaskaak
This works in 7.3,


FYI: It does *NOT* work. It might have when I tested it a while ago, but it doesn't work anymore now.
_________________________

Top
#316956 - 05/12/08 12:43 PM Re: User Authentication Class [Re: blaaskaak]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 304
Loc: The Netherlands
Originally Posted By: blaaskaak
FYI: It does *NOT* work. It might have when I tested it a while ago, but it doesn't work anymore now.


okay, got it working again. If you are in desperate need for it, pm me, since my fixes are far from neat. I just plunged through it and tried stuff till I got it working.

Also, the forum permissions stuff is all disabled in my fix.
_________________________

Top
#317385 - 07/08/08 05:53 AM Re: User Authentication Class [Re: Ian Spence]
Myke Offline
Power User

Registered: 09/06/99
Posts: 87
Loc: Sydney, Australia
Php Code:
// Am I in group 3?
if( $userob->in_group( 3 ) ) {
	// Why, yes we are
} 


Is anyone out there using the in_group check successfully? I'm running 7.2.2 and it doesn't seem to work for me.

I've got a simple conditional check:

Php Code:
if ($userob->is_logged_in ) {
  if (in_array($userob->fields['USER_ID'], $authors)) {
	// Allow specific IDs
	$allow = 1;
  } elseif ($userob->in_group(5)) {
	// Allow members in Group 5
	$allow = 1;
  } else {
	// Not allowed
	$allow = 0;
  }
} 


which fails, even though a user is part of group id 5. The individual ID check works fine though.

Top
#317386 - 07/08/08 09:04 AM Re: User Authentication Class [Re: Myke]
Gizmo Administrator Offline
Wizard

Registered: 01/10/00
Posts: 5134
Loc: Portland, OR, USA
Has anyone gotten this working (at least checking groups) in 7.3? I need something for a project I'm working on...
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design Owner

Top
#317387 - 07/08/08 05:40 PM Re: User Authentication Class [Re: Gizmo]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 304
Loc: The Netherlands
I've got it working in 7.3, but I did not implement group checking yet. I only need it in one homemade script, and just made a query in that specific script.

Php Code:
$query = "
	select count(USER_ID) from ubbt_USER_GROUPS
	where USER_ID = ?
	and GROUP_ID in (
	SELECT GROUP_ID
	FROM ubbt_FORUM_PERMISSIONS
	WHERE FORUM_ID = ?
	AND READ_TOPICS > 0 )
";
$sth = $dbh -> do_placeholder_query($query,array($myuserid,$board),__LINE__,__FILE__);
list($access) = $dbh->fetch_array($sth);

if (!$access) { 
echo "SeeYa";exit; }
 


I am converting most of my scripts to the ubb environment where authentication and group checking is done for me smile
_________________________

Top
#317388 - 07/08/08 06:11 PM Re: User Authentication Class [Re: blaaskaak]
sirdude Moderator Offline
Enthusiast

Registered: 11/08/03
Posts: 442
Loc: SoCal
as long as you include user.inc.php in your user auth dude, the code would be

Php Code:
$yarp = new user();  // only needs to be done 1 time
if (!$yarp->check_access('forum','READ_TOPICS',$board)) {
   echo 'Ciao bella!';
   exit;
}
if ($yarp->check_access('site','CAN_USE_ARCADE')) {
  echo 'w00t! and arcade :)';
}  


reason for $userobaxx is that $userob is prolly in use for the user_auth dealio smile

so to modify my original post a bit:

Php Code:
include ('../libs/forums/includes/user.inc.php');
include ('../libs/forums/includes/user_auth.inc.php');

// Instantiate the user auth class as muhaha, for example
$muhaha = new user_auth();	 // w00t, yah baby :rawk:
$yarp = new user();

// Want to create a welcome message? 
if( $muhaha->is_logged_in ) { 
  if( $muhaha->is_banned ) { 
	echo "*cough* be gone, " . $muhaha->fields['USER_DISPLAY_NAME']; 
  } 
else { 
  echo "Waaazzaaaap, " . $muhaha->fields['USER_DISPLAY_NAME']; 
  } 
} else { echo "Please register<br />"; 
  } 
echo "Veni, vidi, vici!! <br />";

// New perm crapola goes here :)
if (!$yarp->check_access('forum','READ_TOPICS',$board)) {
   echo 'Ciao bella!';
   exit;
}
if ($yarp->check_access('site','CAN_USE_ARCADE')) {
  echo 'w00t! and arcade :)';
} 
?> 



Top
#317416 - 07/17/08 05:57 PM Re: User Authentication Class [Re: Ian Spence]
swebs Offline
User

Registered: 10/13/04
Posts: 29
This shows me all the fields|values under the "fields" array but I cant seem to dump the "groups" array.

foreach ($userob->fields as $key => $value) { print "$key $value <br>"; }



Edited by swebs (07/17/08 06:24 PM)

Top
#317418 - 07/18/08 11:50 AM Re: User Authentication Class [Re: swebs]
sirdude Moderator Offline
Enthusiast

Registered: 11/08/03
Posts: 442
Loc: SoCal
that's because it's an array, so you'd need a nested for loop for that array wink
_________________________

Top
#317421 - 07/18/08 06:19 PM Re: User Authentication Class [Re: Ian Spence]
swebs Offline
User

Registered: 10/13/04
Posts: 29
What do we add to this so that we get the site wrapper.

I mean I have what I want working but I would like it all to be placed in the middle section of the site?

Top
#317427 - 07/21/08 08:54 AM Re: User Authentication Class [Re: swebs]
Myke Offline
Power User

Registered: 09/06/99
Posts: 87
Loc: Sydney, Australia
Originally Posted By: swebs
What do we add to this so that we get the site wrapper.

I mean I have what I want working but I would like it all to be placed in the middle section of the site?

Check the sticky thread titled [7.x] Generic Page Outside of forum directory in this forum.

Top
#317428 - 07/21/08 01:44 PM Re: User Authentication Class [Re: Ian Spence]
swebs Offline
User

Registered: 10/13/04
Posts: 29
The problem is that I have a bunch of dynamic pages that call eachother. I would have to create a bunch of wrapper pages.

Is there any way to create 1 file the I can include in my code to add the header and footer of the site?

Top
Page 2 of 3 < 1 2 3 >


Moderator:  sirdude 
Who's Online
0 registered (), 18 Guests and 10 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Wisdom needed
by Gizmo
Yesterday at 10:54 AM
How to hide sub forums from summary page
by blaaskaak
12/03/08 09:54 AM
Spell Check [beta]
by Bill B
12/01/08 09:16 PM
PhotoPost BB Code Popup
by AllenAyres
12/01/08 09:41 AM
Problems reading a lot of old posts here
by AllenAyres
12/01/08 09:35 AM
Forum 'Trader Ratings'.
by AllenAyres
12/01/08 09:33 AM
Customization needed
by Gizmo
11/12/08 12:28 PM
New Mods
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Spell Check [beta]
by
10/17/06 09:24 PM
Newest Members
Truth, David DelMonte, nick1, Begbie, cenk
13364 Registered Users
Top Posters
AllenAyres 25452
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438