Advertisement
Ewolutions

AntiReklama

Feb 25th, 2012
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.72 KB | None | 0 0
  1. stock Advert(text [])
  2. {
  3.     if (!isnull (text))
  4.     {
  5.         new
  6.             idx,
  7.             i,
  8.             ipstring [128],
  9.             string [128],
  10.             len = strlen (text);
  11.  
  12.         for (i = 0; i < len; ++i)
  13.             if (text [i] != ' ')
  14.                 string [idx++] = text [i];
  15.  
  16.         if (!(len = strlen (string)))
  17.             return false;
  18.  
  19.         if (!strfind (string, "www.", false) || !strfind (string, "http://", false) || !strfind (string, ".com", false) || !strfind (string, ".net", false)
  20.             || !strfind (string, ".de", false) || !strfind (string, ".cz", false) || !strfind (string, ".sk", false) || !strfind (string, ".tk", false) || !strfind (string, ".org", false))
  21.             return true;
  22.  
  23.    
  24.         for (i = 0, idx = 0; i < len; ++i)
  25.         {
  26.             if (string [i] == ':')
  27.             {
  28.                 ipstring [idx] = '\0';
  29.                 if (ipstring [0] && SplitIp (ipstring) != 0xFFFFFFFF)
  30.                     return true;
  31.                 idx = 0;
  32.                 ipstring [0] = '\0';
  33.             }
  34.             else if ('0' <= string [i] <= '9' || string [i] == '.')
  35.                 ipstring [idx++] = string [i];
  36.         }
  37.  
  38.         ipstring [idx] = '\0';
  39.         if (ipstring [0] && SplitIp (ipstring) != 0xFFFFFFFF)
  40.             return true;
  41.     }
  42.     return false;
  43. }
  44.  
  45. stock SplitIp (ipstring [])
  46. {
  47.     new
  48.         j,
  49.         bytes [4],
  50.         word;
  51.  
  52.     for (new i = 0, len = strlen (ipstring); i < len; ++i)
  53.     {
  54.         if (j > 3)
  55.             return 0xFFFFFFFF;
  56.  
  57.         if (ipstring [i] == ' ')
  58.             continue;
  59.  
  60.         if (ipstring [i] == '*')
  61.             bytes [j] = 0xFF;
  62.         else if (ipstring [i] == '.')
  63.         {
  64.             ++j;
  65.         }
  66.         else if ('0' <= ipstring [i] <= '9')
  67.         {
  68.             bytes [j] = 10 * bytes [j] + ipstring [i] - '0';
  69.             if (bytes [j] > 0xFF || bytes [j] < 0)
  70.                 return 0xFFFFFFFF;
  71.         }
  72.         else
  73.             return 0xFFFFFFFF;
  74.     }
  75.     DOB::BytesToWord (bytes [0], bytes [1], bytes [2], bytes [3], word);
  76.     return word;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement