View Full Version : How can I restrict access by usergroup?
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
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://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:
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:include("./global.php");
if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $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
include("./global.php");
if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $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
include("./global.php");
if (!$bbuserinfo[userid] || $bbuserinfo[usergroupid]==1 || $bbuserinfo[usergroupid]==3) {
show_nopermission();
}
eval("dooutput(\"".gettemplate("chat")."\");");
?>
chat template:
<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 :)
Evoir
08-07-2001, 02:17 AM
I think I am going to sign up for Digichat hosted chat. Can someone clarify if this code works? And in addition, if you were to be so kind, summarize once again how one would set this up? I'm a dummy in this area, but my members are chatting on my vB and my host is not going to be happy. I must have a chat, and I really need it integrated. Digichat looks sweet, if I can get it to allow only certain groups....
pretty please?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.