?
Solved

problems with message

Posted on 2006-10-20
8
Medium Priority
?
163 Views
Last Modified: 2010-04-05
I been trying to stop accounts from joining any public rooms but I want it so it will check rooms and if the room is 'Support Room' it will allow them to join but any thing else it would reject them anyone got any idears??

dat[0] gets current room name
 (Dm.UserTyp='2')  is account level I wish to stop from accessing rooms


[code]
   if (dat[0]=dat[0]) // Check room names
      and
      (Dm.UserTyp='2') // Check account level
   then
   begin
     Showmessage('Sorry!, Help Accounts are unable to access public areas.');
     Exit;
   end
   else
begin


hope sumone can help thanks
0
Comment
Question by:fiveuk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
8 Comments
 
LVL 1

Expert Comment

by:malsoft
ID: 17774488
From your code stub, it looks like you are testing for equality on the same thing at the start ( dat[0] = dat[0] ), that would always be true ( e.g. "1" = "1" and "aaa" = "aaa" etc). If dat[0] contains the room name, maybe you need the following test:

if (dat[0] = {name of support room} ) and (Dm.UserTyp = '2') then
...
0
 

Author Comment

by:fiveuk
ID: 17774757
ok following code stops me from entering support room

   if (dat[0] = 'English Help') // Check room names
      and
      (Dm.UserTyp='2') // Check account level
   then

but I want to be able to enter that room and thing other then English Help would get the error msg!
0
 
LVL 28

Expert Comment

by:TName
ID: 17774861
I'm not sure I understand you. Do you want anyone with UserTyp 2 to ONLY be able to enter the supportroom?

if (dat[0] <> 'Support Room')  and  (Dm.UserTyp='2')
   then begin
     Showmessage('Sorry!, Help Accounts are unable to access public areas.');
     Exit;
   end
   else begin
     //
   end;
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:fiveuk
ID: 17774901
no I would like it so anyone with UserTyp='2' will not to be able to enter any room other then Support Room
0
 
LVL 28

Expert Comment

by:TName
ID: 17774945
>no I would like it so anyone with UserTyp='2' will not to be able to enter any room other then Support Room
I think that's exactly what I said :)

if (dat[0] <> 'Support Room')   //if room is any other than support room
   and                                     //and at the same time
   (Dm.UserTyp='2')                //user type is 2
   then begin                           //then reject  
     Showmessage('Sorry!, Help Accounts are unable to access public areas.');
     Exit;
   end
   else begin
     //
   end;
0
 
LVL 1

Accepted Solution

by:
malsoft earned 500 total points
ID: 17774956
OK, looks like you may want to reverse the logic for the tests. The limiting factor (UserTyp = '2') should be checked first, not what board you are in:

if (Dm.UserTyp = '2') then  // restricted accounts
begin
  if (dat[0] <> 'English Help') then
  begin
    ShowMessage('Sorry...');
    Exit; // leaves routine
  end;

  // continue with "support" options from here...
end
else begin  // non-restricted accounts
...
end;
0
 

Author Comment

by:fiveuk
ID: 17775041
Ok that worked fine but now the problem is all other accounts can not access rooms lol here full code

[code]

if (com='RJoinRoom')then
begin
  if ChatFormTable.Locate('Name',dat[0],[])=false then
  begin
  if (Dm.UserTyp = '2') then  // restricted accounts
  begin
  if (dat[0] <> 'English Help') then
  begin
    Showmessage('Sorry!, Help Accounts are unable to access public areas.');
    Exit; // leaves routine
  // continue with "support" options from here...
end
else begin  // non-restricted accounts
    if NewRForm<>nil  then NewRForm.Close;
    if EnterForm<>nil then EnterForm.Close;
//    if ListForm<>nil  then ListForm.Close;
    if ChatFormTable.Locate('Name',dat[0],[])=false then
     begin
      Application.CreateForm(TChatForm, CForm0);
      CForm0.Name:='chat'+inttostr(CForm0.handle);
      if ChatFormTable.RecordCount=0 then CForm0.media:=true else CForm0.media:=false;
      ChatFormTable.Append;
      ChatFormTable.FieldByName('Name').AsString:=dat[0];
      ChatFormTable.FieldByName('FormName').AsString:=CForm0.Name;
      ChatFormTable.Post;
      CForm0.RoomName:=dat[0];
      CForm0.GroupName:=dat[2];
      CForm0.Caption:=dat[0];
      MyHand:=False;
      Speak:=false;
//      if pos('SPEEX',uppercase(dat[6]))>0 then dat[6]:=copy(dat[6],pos('SPEEX',uppercase(dat[6]))+5,length(dat[6]));
      CForm0.Codec:=dat[6];
      CForm0.PrepareCodec(dat[6]);
      CForm0.Show;
      if (Dm.UserTyp='2')or(Dm.UserTyp='3')then
        CForm0.ChatPopup.Items[4].Visible:=true
      else
       CForm0.ChatPopup.Items[4].Visible:=false;
      if dat[1]='1' then
       begin
        CForm0.Owner:=true;
        CForm0.ChatPopup.Items[4].Visible:=true;
       end
      else
       CForm0.Owner:=false;
      CForm0.SKForm.Caption:=dat[0];
      s:='šGetChatUsersœ'+dat[0]+'œ';
      Socket.SendText(CodeStr(s));
     end
    else
     begin
      CForm0:=Application.FindComponent(ChatFormTableFormName.AsString) as TChatForm;
      if CForm0<>nil then
       begin
        if CForm0.UserTable.Locate('Name',DM.UserName,[])then
         begin
          CForm0.UserTable.Append;
          CForm0.UserTable.FieldByName('Name').AsString:=DM.UserName;
          CForm0.UserTable.FieldByName('Owner').AsString:=dat[1];
          CForm0.UserTable.Post;
          if dat[1]='1' then
           CForm0.VTSInsert(dat[0],dat[1],dat[3],dat[4],'0','0',dat[7])
          else
           CForm0.VTSAppend(dat[0],dat[1],dat[3],dat[4],'0','0',dat[7]);
         end;
         end;
       end;
     end;
     end;
   end;
end;
0
 

Author Comment

by:fiveuk
ID: 17775245
Ok i fixed it thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question