vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How can I restrict access by usergroup? (https://vborg.vbsupport.ru/showthread.php?t=20130)

grumpy 06-13-2001 11:45 AM

I have a login hack for my DigiChat room, and it works great. Unfortunately, it also allows users awaiting email confirmation to still access the chat. Therefore, people can get in without even providing a valid email.

So, I'd like to know if there is a way to restrict access to only members in the Registered usergroup? At this point, I have my 'awaiting email confirmation' usergroup set up to not allow access to the forum at all, preventing them from getting in the chat. But I really don't want that as a permanent option. Can I add a usergroup variable to this and if so, what should it be?

Here is my code:

PHP Code:

<?php
    
    
if( $bbuserid ) {

      
$user        $DB_site->query_first"SELECT username
                                               FROM user 
                                              WHERE userid = 
$bbuserid);
      
$bbuserinfo  $userusername ];


      
      print( 
"<APPLET align=middle code=\"com.diginet.digichat.client.DigiChatApplet\" 
codeBase=\"http://host4.digichat.com/DigiChat/DigiClasses/\"
 width=\"200\" height=\"100\" align=\"middle\" ARCHIVE=\"client.jar\" nickname=\"
$username\">
          <PARAM NAME=\"siteID\" VALUE=\"xxxx\">
          <PARAM NAME=\"cabbase\" VALUE=\"Client.cab\">
          <PARAM NAME=\"background\" VALUE=\"000000\">
          <PARAM NAME=\"textcolor\" VALUE=\"ffffff\">
          <param name=\"floodControl\" value=\"1000\">

          <PARAM NAME=\"nickname\" VALUE=\"
$bbuserinfo\">
          <PARAM NAME=\"openProfileURL\" VALUE=\"true\">
            <PARAM NAME=\"room\" VALUE=\"chat-room-name\">     
          Our Chat requires a Java Compatible web browser to run.
          </APPLET>\n" 
);

    } else { 

      print( 
"<BODY BGCOLOR=\"#000000\">
<CENTER>
<FONT FACE=\"verdana, arial\" size=\"2\" color=\"white\">
Sorry, you must be logged into the Forum to use Chat!</font><br>" 
);

    } 
// end if
    
?>


Thanks :)

JamesUS 06-13-2001 02:32 PM

Add the variable "usergroupid" to the select statement:

Quote:

SELECT username, usergroupid...
I believe the ID of the group that is awaiting email confirmation is "3" but I'd need to check.

Post back if you need example code.

grumpy 06-13-2001 02:34 PM

Thank you! And yes, example code would be appreciated.

:)

Freddie Bingham 06-13-2001 02:36 PM

It appears your code is for vb 1.1.x but if you want to do something with 2.0, this sort of thing would get you where you want to go:
PHP Code:

include("./global.php");
if (!
$bbuserinfo[userid] || $bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==3) {
    
show_nopermission();
}
eval(
"dooutput(\"".gettemplate("chat")."\");"); 


fugzy 06-21-2001 03:50 AM

okay that code works okay for digichat, but i get this error:

Parse error: parse error in e:\inetpub\wwwroot\vb\chat2.php(7) : eval()'d code on line 27

im using vb2.0 help me plz

JohnM 06-21-2001 04:00 AM

PHP Code:

include("./global.php");
if (!
$bbuserinfo[userid] || $bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==3) {
    
show_nopermission();
}
eval(
"dooutput(\"".gettemplate("chat")."\");"); 


fugzy 06-21-2001 04:28 AM

k it works... here is the full code i use to incorporate digichat 3.5 into vbulletin 2.0

<?php

include("./global.php");
if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3) {
show_nopermission();
}
eval("dooutput(\"".gettemplate("chat")."\");");

if( $bbuserid ) {

$user = $DB_site->query_first( "SELECT username
FROM user
WHERE userid = $bbuserid" );
$bbuserinfo = $user[ username ];


print( "<APPLET align=middle code=\"com.diginet.digichat.client.DigiChatApplet\ "
codeBase=\"http://www.blah.com/DigiChat/DigiClasses/\"
width=\"200\" height=\"100\" align=\"middle\" ARCHIVE=\"client.jar\" nickname=\"$username\">
<PARAM NAME=\"siteID\" VALUE=\"1000\">
<PARAM NAME=\"cabbase\" VALUE=\"Client.cab\">
<PARAM NAME=\"background\" VALUE=\"000000\">
<PARAM NAME=\"textcolor\" VALUE=\"ffffff\">
<param name=\"floodControl\" value=\"1000\">

<PARAM NAME=\"nickname\" VALUE=\"$bbuserinfo\">
<PARAM NAME=\"openProfileURL\" VALUE=\"true\">
<PARAM NAME=\"room\" VALUE=\"chat-room-name\">
Our Chat requires a Java Compatible web browser to run.
</APPLET>\n" );

} else {

print( "<BODY BGCOLOR=\"#000000\">
<CENTER>
<FONT FACE=\"verdana, arial\" size=\"2\" color=\"white\">
Sorry, you must be logged into the Forum to use Chat!</font><br>" );

} // end if

it still needs a lil cleanin up... cause it displays the connect string all weird on the page, etc... can it like close the old window when a person clicks on chat?

fugzy 06-21-2001 04:45 AM

it keeps bringin up a window saying the siteid you entered is invalid yet it still works... why is that? but sometimes my users can't get on... hrmm

can someone plz post a complete working hack for digichat 3.5 to work with vbulletin 2.0... complete with the chat.php and the templates that you're suppose to add...

JohnM 06-23-2001 05:22 PM

PHP Code:

<?php

include("./global.php");
if (!
$bbuserinfo[userid] || $bbuserinfo[usergroupid]==|| $bbuserinfo[usergroupid]==3) {
    
show_nopermission();
}
eval(
"dooutput(\"".gettemplate("chat")."\");");

?>

chat template:
Code:

<APPLET align=middle code="com.diginet.digichat.client.DigiChatApplet"
codeBase="http://www.yoursite.com/DigiChat/DigiClasses/"
 width="200" height="100" align="middle" ARCHIVE="client.jar" nickname="$bbuserinfo[username]">
          <PARAM NAME="siteID" VALUE="site id">
          <PARAM NAME="cabbase" VALUE="Client.cab">
          <PARAM NAME="background" VALUE="{ pagebgcolor}">
          <PARAM NAME="textcolor" VALUE="{ pagetextcolor}">
          <param name="floodControl" value="1000">
          <PARAM NAME="nickname" VALUE="$bbuserinfo[username]">
          <PARAM NAME="openProfileURL" VALUE="true">
          <PARAM NAME="room" VALUE="chat-room-name">   
          Our Chat requires a Java Compatible web browser to run.
          </APPLET>

Remove the spaces for the replacement variables in red above, and insert the correct values that are in blue.

Mark4444 06-28-2001 05:31 PM

Anyone know what the usergroup id for (COPPA) Users Awaiting Moderation is??

And i would assume all i'd have to do would be to add that into the code you have JohnM

<?php

include("./global.php");
if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3 || $bbuserinfo[usergroupid]==?) {
show_nopermission();
}
eval("dooutput(\"".gettemplate("chat")."\");");

?>

Of course i'd replace the ? with whatever the coppa usergroup id is.

Thanks in advance :)


All times are GMT. The time now is 06:11 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01176 seconds
  • Memory Usage 1,765KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete