Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
leo51
Worker
Worker



Joined: Sep 09, 2004
Posts: 106
Location: Canada

PostPosted: Sat Nov 04, 2006 3:36 pm Reply with quote

Hi, I can't make anymore head-way after many hours of trying.

I have this authentication script which with help I was able to get it do what I want and that is to call it up so I can use my database user/password for my chat which is embeded in a Raven76, but now I need to have an addition level. LEVEL
Code:
<?php

     header('Content-type: text/plain');
     $guest = 1; // Set this to 0 (ZERO) to disable guest access..
     define('IN_PHPBB', true);
     $retval = $guest;
     $phpbb_root_path = './';
     include($phpbb_root_path . 'extension.inc');
     include($phpbb_root_path . 'common1.' . $phpEx);
         $username = $HTTP_GET_VARS['username'];
         $password = $HTTP_GET_VARS['password'];
         $md5password = md5($password);
         $ip = $HTTP_GET_VARS['ip'];
         
         $sql = "SELECT chat_rights, user_password FROM " . USERS_TABLE . " " .
                 "WHERE username = '" . str_replace("\'", "''", $username) .  "' " .
                 "AND user_active > 0"; 
                 
         if ($result = $db->sql_query($sql))
         {
             if($row = $db->sql_fetchrow($result))
             {
                 // Both MD5 password equiv. and plain text password OK.
                 if( ($row['user_password'] == $password) || ($row['user_password'] == $md5password) )
                 {
                 /* Password is valid, proceed... */
     $retval = 3;
          /* Is this user an admin? */
     if($row['chat_rights'] == ADMIN)
     {
         $retval = 1; /* Invalid password. */
                 }
                 else
                    $retval = 3; /* Invalid password. */
}
                 else
                    $retval = 0; /* Invalid password. */
             }
         }
         else {
             $retval = 0; // Query Failed.
         }
         
         echo "$retval\n"; 
   
?>


0 No access
1 allow Guest/regular user
2 Moderator
3 Supper Admin

As you can see I have 0, 1 and 3 working OK I need to have the script out put a 2 where from MYSQL I can manually set level 2. I just need to get four (4) out puts.

I hope that I have made some sense in what I want.


Thanks
 
View user's profile Send private message Visit poster's website MSN Messenger
gregexp
The Mouse Is Extension Of Arm



Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Sat Nov 04, 2006 4:22 pm Reply with quote

The way its coded, Seems as if your contradicting yourself.
Youll have to explain to me exactly how its trying to tell if they are admin or what.

That will help a lot.

_________________
For those who stand shall NEVER fall and those who fall shall RISE once more!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
leo51







PostPosted: Sat Nov 04, 2006 4:59 pm Reply with quote

darklord wrote:
The way its coded, Seems as if your contradicting yourself.
Youll have to explain to me exactly how its trying to tell if they are admin or what.

That will help a lot.


OK, Thanks......

1: I use my raven user database for my chatlogin I just set remote authentication in my chat CP so I can use a customize login script.

If I set a user as moderator in my forum, that's level 2 in my database so since I can get the script to out put a 2 in plain text access is granted to the chat. An incorrect password outputs a 0 so username is denied. A 1 will give Guest access.

Now since a normal user in by database user level field is 1 if a registered username/passaword match, that user is granted access to the chat because it accetps a 1 for normal user.

Admin rights in my chat have two levels and for simplicity I will say [Normal Admin and Super Admin[/b] for nor admin is 2 and for super admin is 3.

Therefore, my little script must be able when it receives a login username/password which matches up with my ravennuke database the script will give the corresponding results set in my database.

I just added a field in my nuke_user table [user_rights] but could stick with the normal [user_level] just made it seperate.

The script works fine it is just that I need an admin level right 2 so these admin do not have full control in my chat only supper admins.

Hope I am a bit more clear. [I can replace 3 with 2] but that still gives me two options and I need three....In my ravennuke database I can set 2 and 3

Thanks for coming up
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©