Began working on checks

This commit is contained in:
pezcurrel 2023-12-28 12:37:38 +01:00
parent 89f4d38704
commit 6a3948783f

View file

@ -49,21 +49,25 @@ for ($i=1; $i<$argc; $i++) {
}
}
$codoms=0;
$ocont=@file($opts['ofpath'],FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
if (is_array($ocont))
$codoms=count($ocont);
$cont=@file($opts['url'],FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
if (is_array($cont)) {
$domlist=[];
$doms=[];
foreach ($cont as $line)
if (preg_match('#<li>\s*🖤\s*[a-z0-9\.\-\_]+@([a-z0-9\.\-\_]+)\s*</li>#iu',$line,$matches)===1)
if (!in_array($matches[1],$domlist))
$domlist[]=mb_strtolower($matches[1]);
$cdomlist=count($domlist);
if ($cdomlist>0) {
sort($domlist);
$domlist=implode(N,$domlist);
if (@file_put_contents($opts['ofpath'],$domlist.N)===false)
if (!in_array($matches[1],$doms))
$doms[]=mb_strtolower($matches[1]);
$cdoms=count($doms);
if ($cdoms>0) {
sort($doms);
$doms=implode(N,$doms);
if (@file_put_contents($opts['ofpath'],$doms.N)===false)
mexit('couldnt save domain list into «'.$opts['ofpath'].'» :-('.N,3);
else
eecho('done saving '.$cdomlist.' entries into «'.$opts['ofpath'].'» :-)'.N,1);
eecho('done saving '.$cdoms.' entries into «'.$opts['ofpath'].'» :-)'.N,1);
} else {
mexit('couldnt find any domain in «'.$opts['url'].'» :-('.N,2);
}