Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stock Advert(text [])
- {
- if (!isnull (text))
- {
- new
- idx,
- i,
- ipstring [128],
- string [128],
- len = strlen (text);
- for (i = 0; i < len; ++i)
- if (text [i] != ' ')
- string [idx++] = text [i];
- if (!(len = strlen (string)))
- return false;
- if (!strfind (string, "www.", false) || !strfind (string, "http://", false) || !strfind (string, ".com", false) || !strfind (string, ".net", false)
- || !strfind (string, ".de", false) || !strfind (string, ".cz", false) || !strfind (string, ".sk", false) || !strfind (string, ".tk", false) || !strfind (string, ".org", false))
- return true;
- for (i = 0, idx = 0; i < len; ++i)
- {
- if (string [i] == ':')
- {
- ipstring [idx] = '\0';
- if (ipstring [0] && SplitIp (ipstring) != 0xFFFFFFFF)
- return true;
- idx = 0;
- ipstring [0] = '\0';
- }
- else if ('0' <= string [i] <= '9' || string [i] == '.')
- ipstring [idx++] = string [i];
- }
- ipstring [idx] = '\0';
- if (ipstring [0] && SplitIp (ipstring) != 0xFFFFFFFF)
- return true;
- }
- return false;
- }
- stock SplitIp (ipstring [])
- {
- new
- j,
- bytes [4],
- word;
- for (new i = 0, len = strlen (ipstring); i < len; ++i)
- {
- if (j > 3)
- return 0xFFFFFFFF;
- if (ipstring [i] == ' ')
- continue;
- if (ipstring [i] == '*')
- bytes [j] = 0xFF;
- else if (ipstring [i] == '.')
- {
- ++j;
- }
- else if ('0' <= ipstring [i] <= '9')
- {
- bytes [j] = 10 * bytes [j] + ipstring [i] - '0';
- if (bytes [j] > 0xFF || bytes [j] < 0)
- return 0xFFFFFFFF;
- }
- else
- return 0xFFFFFFFF;
- }
- DOB::BytesToWord (bytes [0], bytes [1], bytes [2], bytes [3], word);
- return word;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement