Menu

Match RealHosts to HostMasks

Help
2003-05-21
2003-07-08
  • Matt Lehner

    Matt Lehner - 2003-05-21

    Hello,

    I love this class, but I am having trouble figuring out how to use hostmasks stored in a file, and compare them to the realhost from the users. For example.

    Hostmask: *@*.buf.adelphia.net
    Realhost: xavia@ny-hamburg2b-36.buf.adelphia.net

    I want to be able to tell that the realhost matches the hostmask. How could I do this in php? Any help would be great.

     
    • Nobody/Anonymous

      You can do this with regular expressions.
      You should replace the IRC wildcards with the regular ones.
      * should became something like [a-z0-9\._-]*, but containing all characters available for IRC
      For example:
      *!*@*.anything.com should be something like
      [a-z0-9_-\[\]]*![a-z0-9_-\[\]]*@[a-z0-9_-]*.anything.com

      I'm not good at regular expressions, so please read the php help file for this topic.

      Have fun

          Horcsog

       
    • Matt Lehner

      Matt Lehner - 2003-05-21

      Thanks,

      I am not the best with regualar expressions either, but I will play around with it.

      Matt

       
    • Anonymous

      Anonymous - 2003-07-06

      just as a pointer, *@*.buf.adelphia.net isn't a valid irc host, but *!*@*.buf.adelphia.net would be (nick!ident@host)

      anyhow. The format i use for hostmasks would look like this: "^[^!]*![^@]@[^.]\.buf\.adelphia\.net$". The starting ^ and tailing $ aren't necessary, but i use them. And don't forget to escape dots, if you want the literal dot to be matched (not any charachter)

       
      • Anonymous

        Anonymous - 2003-07-06

        typical, i forgot two asterisks. sorry 'bout that:

        ^[^!]*![^@]*@[^.]*\.buf\.adelphia\.net$

         
    • Matt Lehner

      Matt Lehner - 2003-07-08

      Thanks hpaul that helps alot. I have one more question. How could I take the full hostname and make a hostmask from that? I am guessing preg_replace, but I have yet to figure out regular expressions and can't get anything to work right. If you could help me with this it would be great, otherwise I am sure I will figure it out sooner or later.

       
      • Anonymous

        Anonymous - 2003-07-08

        I haven't tried replacing expressions, i'm sorry. But solving that problem in some conventient way would be handy.

         
        • Nobody/Anonymous

          If I find anything out myself I will make sure to post it here.

           

Log in to post a comment.