<?php
// find_minus.php
// RJM Programming
// March, 2022

$macw='';
$cmdtitlesuffix='';
$cmdtitlefilesuffix='';
$outputts='';
$outputte='';
$toutputts='';
$toutputte='';
$outputtsfile='';
$outputtefile='';
$toutputtsfile='';
$toutputtefile='';
$i=0;
$u='1';
$allowed=["find . -name '*' ", ' -atime ', ' -Btime ', ' -ctime ', ' -mtime '];
$ok=true;
$ps='';
$uv='';
$ut='';
$tswitch='find via access time switch';
$nprefix="<option value=''></option><option value='+'>+</option><option value='-'>-</option>";
$dmoreform='';
$prego='';
if (strpos(strtolower(('' . $_SERVER['SERVER_NAME'])), 'localhost') !== false) {
    $prego="&nbsp;<div onclick='event.stopProgation();' style=display:inline-block; contenteditable=true onblur=\" document.getElementById('postswitch').value=(this.innerText || this.contentWindow || this.contentDocument).trim(); \">&nbsp;</div>";
} else {
    $macw="<div id=ic style=display:inline-block;><a target=_blank title='MAMP for Apache/PHP/MySql on Mac OS X local web server' href='http://www.mamp.info'>MAMP</a> via macOS <input style=display:inline-block; type=checkbox onchange=\"if (!this.checked) { document.getElementById('myform').action='./find_minus.php'; } else { document.getElementById('myform').action='HTTP://localhost:8888/find_minus.php'; } \"></input> or Windows <input style=display:inline-block; type=checkbox onchange=\"if (!this.checked) { document.getElementById('myform').action='./find_minus.php'; } else { document.getElementById('myform').action='HTTP://localhost/find_minus.php'; } \"></input>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>";
}

function maybecet($cdm) {
  global $allowed;
  $outcdm=$cdm;
  if (strpos(strtolower(('' . $_SERVER['SERVER_NAME'])), 'localhost') !== false) {
    if (strpos($outcdm, " '") !== false) {
     if (strpos($outcdm, explode(' ',$allowed[0])[3]) !== false) {
      $outcdm=str_replace(explode(' ',$allowed[0])[3],"'<div onclick='event.stopProgation();' style=display:inline-block; contenteditable=true onblur=\" var bs=document.getElementById('cmnd').value.split(String.fromCharCode(39)); document.getElementById('cmnd').value=document.getElementById('cmnd').value.replace(bs[0] + String.fromCharCode(39) + bs[1] + String.fromCharCode(39),bs[0] + String.fromCharCode(39) + (this.innerText || this.contentWindow || this.contentDocument) + String.fromCharCode(39)); \">" . str_replace("'",'',explode(' ',$allowed[0])[3]) . "</div>'",$outcdm);
     }
    }
    if (strpos($outcdm, " ") !== false) {
     if (strpos($outcdm, ' ' . explode(' ',$allowed[0])[1] . ' ') !== false) {
      $outcdm=str_replace(" " . explode(' ',$allowed[0])[1] . " "," <div onclick='event.stopProgation();' style=display:inline-block; contenteditable=true onblur=\" var bs=document.getElementById('cmnd').value.split(String.fromCharCode(32)); document.getElementById('cmnd').value=document.getElementById('cmnd').value.replace(bs[0] + String.fromCharCode(32) + bs[1] + String.fromCharCode(32),bs[0] + String.fromCharCode(32) + (this.innerText || this.contentWindow || this.contentDocument) + String.fromCharCode(32)); \">" . explode(' ',$allowed[0])[1] . "</div> ",$outcdm);
     }
    }
  }
  return $outcdm;
}

function rework($incd) {
  //return $incd;
  global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps;
  $outcd=$incd;
  if ($ps != '') {
    if (strpos($incd, str_replace("'",'"',$ps)) !== false) {
       if ($cmdtitlesuffix != '' && strpos($incd, $cmdtitlesuffix) === false) {
         $extra=explode(str_replace("'",'"',$ps), $incd)[1];
         $outcd=str_replace(str_replace("'",'"',$ps),$cmdtitlesuffix, $incd) . ' ' . str_replace("'",'"',$ps) . $extra;
       } else if ($cmdtitlefilesuffix != '' && strpos($incd, $cmdtitlefilesuffix) === false) {
         $extra=explode(str_replace("'",'"',$ps), $incd)[1];
         $outcd=str_replace(str_replace("'",'"',$ps),$cmdtitlefilesuffix, $incd) . ' ' . str_replace("'",'"',$ps) . $extra;
       }
    }
  }
  return $outcd;
}

function reworkt($incd) {
  //return $incd;
  global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps;
  $aps=$ps;
  if ($ps != '' && strpos($incd, '-exec ') !== false && strpos($incd, str_replace("'",'`',str_replace('"','`',$ps))) === false && strpos($incd, ' ls -l') !== false) {
    $aps=str_replace("file","ls -l",$ps);
  } else if ($ps != '' && strpos($incd, '-exec ') !== false && strpos($incd, str_replace("'",'`',str_replace('"','`',$ps))) === false && strpos($incd, ' file') !== false) {
    $aps=str_replace("ls -l","file",$ps);
  }
  $outcd=$incd;
  if ($aps != '') {
    if (strpos($incd, str_replace("'",'`',str_replace('"','`',$aps))) !== false) {
       if ($cmdtitlesuffix != '' && strpos($incd, $cmdtitlesuffix) === false) {
         $extra=explode(str_replace("'",'`',str_replace('"','`',$aps)), $incd)[1];
         $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlesuffix . ' ',   str_replace(str_replace("'",'`',str_replace('"','`',$aps)),$cmdtitlesuffix, $incd) . ' ' . str_replace("'",'`',str_replace('"','`',$aps))); // . $extra;
       } else if ($cmdtitlefilesuffix != '' && strpos($incd, $cmdtitlefilesuffix) === false) {
         $extra=explode(str_replace("'",'`',str_replace('"','`',$aps)), $incd)[1];
         $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlefilesuffix . ' ',   str_replace(str_replace("'",'`',str_replace('"','`',$aps)),$cmdtitlefilesuffix, $incd) . ' ' . str_replace("'",'`',str_replace('"','`',$aps))); // . $extra;
       }
    }
  }
  return $outcd;
}

function ourexec($incd) {
  global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps;
  $outcd=$incd;
  if ($ps != '') {
    if (strpos($incd, str_replace('"',"'",$ps)) !== false) {
       if ($cmdtitlesuffix != '' && strpos($incd . '~', $cmdtitlesuffix . '~') !== false) {
         $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlesuffix . ' ',   str_replace(str_replace('"',"'",$ps),$cmdtitlesuffix, explode($cmdtitlesuffix, $incd)[0]) . str_replace('"',"'",$ps));
       } else if ($cmdtitlefilesuffix != '' && strpos($incd . '~', $cmdtitlefilesuffix . '~') !== false) {
         $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlefilesuffix . ' ',   str_replace(str_replace('"',"'",$ps),$cmdtitlefilesuffix, explode($cmdtitlefilesuffix, $incd)[0]) . str_replace('"',"'",$ps));
       }
    }
  }
  if (strpos($outcd, '|') !== false) {
    return exec('(' . $outcd . ')');
  }
  return exec($outcd);
}

function ourshell_exec($incd) {
  global $cmdtitlesuffix, $cmdtitlefilesuffix, $ps;
  $outcd=$incd;
  if ($ps != '') {
    if (strpos($incd, str_replace('"',"'",$ps)) !== false) {
       if ($cmdtitlesuffix != '' && strpos($incd . '~', $cmdtitlesuffix . '~') !== false) {
         $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlesuffix . ' ',   str_replace(str_replace('"',"'",$ps),$cmdtitlesuffix, explode($cmdtitlesuffix, $incd)[0]) . str_replace('"',"'",$ps));
       } else if ($cmdtitlefilesuffix != '' && strpos($incd . '~', $cmdtitlefilesuffix . '~') !== false) {
         $outcd=str_replace("-exec ls -l {} \; -exec file {} \;", $cmdtitlefilesuffix . ' ',   str_replace(str_replace('"',"'",$ps),$cmdtitlefilesuffix, explode($cmdtitlefilesuffix, $incd)[0]) . str_replace('"',"'",$ps));
       }
    }
  }
  if (strpos($outcd, '|') !== false) {
    return shell_exec('(' . $outcd . ')');
  }
  return shell_exec($outcd);
}

if (PHP_OS =='WINNT' || PHP_OS =='WIN32' || PHP_OS =='Windows') {
  $allowed=['dir .\* /S ', ' /O:-D '];
  $tswitch='dir newest files first';
} else if (strpos($_SERVER['SERVER_NAME'], 'rjmprogramming.com.au') !== false) {
  $allowed=["find . -name '*' ", ' -atime ', ' -Btime ', ' -ctime ', ' -mtime '];
  $cmdtitlesuffix=' -exec ls -l {} \;';
  $cmdtitlefilesuffix=' -exec file {} \;';
} else {
  $cmdtitlesuffix=' -exec ls -l {} \;';
  $cmdtitlefilesuffix=' -exec file {} \;';
}

$cmnd=$allowed[0];
$switch=$allowed[1];
if (isset($_GET['cmnd'])) {
   $cmnd=str_replace('+',' ',urldecode($_GET['cmnd']));
   if (strpos(strtolower(('' . $_SERVER['SERVER_NAME'])), 'localhost') !== false && explode(' ',$cmnd)[0] == explode(' ',$allowed[0])[0]) {
     $allowed[0]=$cmnd;
   }
   $ok=false;
   //for ($i=0; $i<sizeof($allowed); $i++) {
     if ($allowed[$i] == $cmnd) { $ok=true; }
   //}
} else if (isset($_POST['cmnd'])) {
   $cmnd=str_replace('+',' ',urldecode($_POST['cmnd']));
   if (strpos(strtolower(('' . $_SERVER['SERVER_NAME'])), 'localhost') !== false && explode(' ',$cmnd)[0] == explode(' ',$allowed[0])[0]) {
     $allowed[0]=$cmnd;
   }
   $ok=false;
   //for ($i=0; $i<sizeof($allowed); $i++) {
     if ($allowed[$i] == $cmnd) { $ok=true; }
   //}
}

if ($cmnd == "" || !$ok) {
  $cmnd=$allowed[0];
}

if (isset($_GET['nprefix'])) {
  $np=str_replace(' ','+',urldecode($_GET['nprefix']));
  if (strlen($np) != '') {
   $nprefix="<option value='" . $np . "'>" . $np . "</option>" . str_replace("<option value='" . $np . "'>" . $np . "</option>","","<option value='+'>+</option><option value='-'>-</option><option value=''></option>");
  }
  $switch.=$np;
} else if (isset($_POST['nprefix'])) {
  $np=str_replace(' ','+',urldecode($_POST['nprefix']));
  if (strlen($np) != '') {
   $nprefix="<option value='" . $np . "'>" . $np . "</option>" . str_replace("<option value='" . $np . "'>" . $np . "</option>","","<option value='+'>+</option><option value='-'>-</option><option value=''></option>");
  }
  $switch.=$np;
}

if (isset($_GET['switch'])) {
  $switch=str_replace('+',' ',urldecode($_GET['switch']));
} else if (isset($_POST['switch'])) {
  $switch=str_replace('+',' ',urldecode($_POST['switch']));
}

$origswitch=$switch;
if (strpos($origswitch, '-mtime') !== false) {
  $tswitch='find via modified time switch';
} else if (strpos($origswitch, '-Btime') !== false) {
  $tswitch='find via file inode creation time switch';
} else if (strpos($origswitch, '-ctime') !== false) {
  $tswitch='find via created time switch';
} else if (strpos($origswitch, '-atime') !== false) {
  $tswitch='find via access time switch';
}

if (isset($_GET['nprefix'])) {
  $switch.=str_replace('+',' ',urldecode($_GET['nprefix']));
} else if (isset($_POST['nprefix'])) {
  $switch.=str_replace('+',' ',urldecode($_POST['nprefix']));
}

if (strpos($switch, '/') === false) {
if (isset($_GET['number'])) {
  $u=str_replace('+',' ',urldecode($_GET['number']));
  if ($u == '') { $u='1'; }
  $switch.=str_replace('+',' ',urldecode($_GET['number']));
} else if (isset($_POST['number'])) {
  $u=str_replace('+',' ',urldecode($_POST['number']));
  if ($u == '') { $u='1'; }
  $switch.=str_replace('+',' ',urldecode($_POST['number']));
} else {
  $switch.='1';
}

if (isset($_GET['unit'])) {
  $uv=str_replace('+',' ',urldecode($_GET['unit']));
  if ($uv != '') {
    $ut=str_replace('m', 'Minute', str_replace('w', 'Week', str_replace('h', 'Hour', str_replace('s', 'Second', str_replace('d', 'Day', $uv))))) . '(s)';
  }
  $switch.=str_replace('+',' ',urldecode($_GET['unit']));
} else if (isset($_POST['unit'])) {
  $uv=str_replace('+',' ',urldecode($_POST['unit']));
  if ($uv != '') {
    $ut=str_replace('m', 'Minute', str_replace('w', 'Week', str_replace('h', 'Hour', str_replace('s', 'Second', str_replace('d', 'Day', $uv))))) . '(s)';
  }
  $switch.=str_replace('+',' ',urldecode($_POST['unit']));
} 

}

if (strpos(strtolower(('' . $_SERVER['SERVER_NAME'])), 'localhost') !== false) {
if (isset($_GET['postswitch'])) {
  $ps=str_replace('  ','  +',str_replace('+',' ',urldecode(str_replace('%C2%A0','',$_GET['postswitch']))));
  if ($ps == 'undefined') { $ps=''; }
  $switch.=' ' . str_replace('"',"'",trim($ps));
  $switch=trim($switch, ' ');
  if ($ps == '') { $ps='&nbsp;'; }
  $prego="&nbsp;<div onclick='event.stopProgation();' style=display:inline-block; contenteditable=true onblur=\" document.getElementById('postswitch').value=(this.innerText || this.contentWindow || this.contentDocument).trim(); \">" . $ps . "</div>";
} else if (isset($_POST['postswitch'])) {
  $ps=str_replace('  ','  +',str_replace('+',' ',urldecode(str_replace('%C2%A0','',$_POST['postswitch']))));
  if ($ps == 'undefined') { $ps=''; }
  $switch.=' ' . str_replace('"',"'",trim($ps));
  $switch=trim($switch, ' ');
  if ($ps == '') { $ps='&nbsp;'; }
  $prego="&nbsp;<div onclick='event.stopProgation();' style=display:inline-block; contenteditable=true onblur=\" document.getElementById('postswitch').value=(this.innerText || this.contentWindow || this.contentDocument).trim(); \">" . $ps . "</div>";
}
}


$selbit=maybecet($cmnd) . "&nbsp;<input type=hidden id=cmnd name=cmnd value=\"" . $cmnd . "\"></input><input type=hidden id=switch name=switch value='" . $origswitch . "'></input><select title='" . $tswitch . "' onchange=\"document.getElementById('switch').value=this.value; titleme(this);\" id=selcmnd><option value='" . $origswitch . "'>" . $origswitch . "</option></SELECT>&nbsp;<select style=display:inline-block; name=nprefix id=nprefix>" . $nprefix . "</select><input style=display:inline-block;width:40px; title='Number of time units' type=number value=" . $u . " step=1 name=number></input>&nbsp;<select title='Time units [Day(s)]' name=unit><option value='" . $uv . "'>" . $ut . "</option><option value='s'>Second(s)</option><option value='m'>Minute(s)</option><option value='h'>Hour(s)</option><option value='d'>Day(s)</option><option value='w'>Week(s)</option></select>";
for ($i=1; $i<sizeof($allowed); $i++) {
 if ($allowed[$i] != $switch) {
  $selbit=str_replace('</SELECT>', '<option value="' . $allowed[$i] . '">' . $allowed[$i] . '</option></SELECT>', $selbit);
 }
}

if ($cmdtitlesuffix != '') {
$toutputte=" onmouseout='setTimeout(onmout,2000);' onmouseover=onmo(event); onclick=\" xx=windowopen('','_blank','top=50,left=50,height=600,width=600'); xxdocumentwrite('<html><body><p>' + this.title + '<br><br><mark>' + '" . str_replace("\n","<br>",ourexec($cmnd . str_replace('  ',' +',$switch) . $cmdtitlesuffix))  . "' + '</mark><br><br>' + '</p></body></html>'); xx.document.title=this.title;\" id=thl title=\"\$outputte = exec('" . reworkt(str_replace("'",'`',$cmnd) . str_replace("'",'`',str_replace('  ',' +',$switch)) . $cmdtitlesuffix) . "');" . "\" ";
$toutputts=" onmouseout='setTimeout(onmout,2000);' onmouseover=onmo(event); onclick=\" xx=windowopen('','_blank','top=50,left=50,height=600,width=600'); xxdocumentwrite('<html><body><p>' + this.title + '<br><br>' + ldebate('" . str_replace("\n","<br>",ourshell_exec($cmnd . str_replace('  ',' +',$switch) . $cmdtitlesuffix))  . "') + '<br><br>' + '</p></body></html>'); xx.document.title=this.title;\" id=thr title=\"\$outputts = shell_exec('" . reworkt(str_replace("'",'`',$cmnd) . str_replace("'",'`',str_replace('  ',' +',$switch)) . $cmdtitlesuffix) . "');" . "\" ";
//$outputte=' id=thld title="' . exec($cmnd . str_replace('  ',' +',$switch) . $cmdtitlesuffix) . '" ';
//$outputts=' id=thrd title="' . shell_exec($cmnd . str_replace('  ',' +',$switch) . $cmdtitlesuffix) . '" ';
$outputte=" onmouseout='setTimeout(onmout,2000);' onmouseover=onmo(event); onclick=\" xx=windowopen('','_blank','top=50,left=50,height=600,width=600'); xxdocumentwrite('<html><body><p>' + this.title + '<br><br><mark>' + '" . str_replace("\n","<br>",ourexec($cmnd . str_replace('  ',' +',$switch) . $cmdtitlefilesuffix))  . "' + '</mark><br><br>' + '</p></body></html>'); xx.document.title=this.title;\" id=thld title=\"\$outputfilete = exec('" . reworkt(str_replace("'",'`',$cmnd) . str_replace("'",'`',str_replace('  ',' +',$switch)) . $cmdtitlefilesuffix) . "');" . "\" ";
$outputts=" onmouseout='setTimeout(onmout,2000);' onmouseover=onmo(event); onclick=\" xx=windowopen('','_blank','top=50,left=50,height=600,width=600'); xxdocumentwrite('<html><body><p>' + this.title + '<br><br>' + ldebate('" . str_replace("\n","<br>",ourshell_exec($cmnd . str_replace('  ',' +',$switch) . $cmdtitlefilesuffix))  . "') + '<br><br>' + '</p></body></html>'); xx.document.title=this.title;\" id=thld title=\"\$outputfilets = shell_exec('" . reworkt(str_replace("'",'`',$cmnd) . str_replace("'",'`',str_replace('  ',' +',$switch)) . $cmdtitlefilesuffix) . "');" . "\" ";
}
$outpute = str_replace("\n", "<br>", ourexec($cmnd . str_replace('  ',' +',$switch)));
$output = str_replace("\n", "<br>", ourshell_exec($cmnd . str_replace('  ',' +',$switch)));

  
// Display the list of all file
// and directory, if chosen
echo "<html><head><title>find_minus.php - PHP Supervise find or dir</title>
<sc" . "ript type='text/javascript'>
 var xx=null; 
 var ishover=false;
 var lrect=null;
 var rrect=null;
 var pointerX=-1;
 var pointerY=-1;
 var origcmnd='';
 
 function ldebate(inh) {
   var outh=inh;
   var outlines=inh.replace(/\<br\>$/g,'').split('<br>');
   var eachlineh=-1;
   var vsi=-1;
   if (lrect && eval('' + pointerY) >= 0) {
     if (eval('' + pointerY) >= eval('' + lrect.top) && eval('' + pointerY) <= eval('' + lrect.bottom)) {
       eachlineh=eval(eval('' + lrect.height) / eval('' + outlines.length));
       vsi=Math.floor(eval(eval('' + pointerY) - eval('' + lrect.top)) / eachlineh);
       console.log('vsi=' + vsi + ' eachlineh=' + eachlineh + ' outlines.length=' + outlines.length + ' inh=' + inh);
       outh=inh.replace(outlines[vsi], '<mark>' + outlines[vsi] + '</mark>');
     }
   }
   return outh;
 }
 
 function onmout(one) {
   if (xx && ishover) {
     ishover=false;
     xx.close();
     xx=null;
   }
 }
 
 function onmo(event) {
   if (document && ('' + event.target.outerHTML).indexOf('</pre>') != -1) {
   ishover=true;
       if (event.touches) {
       if (event.touches[0].pageX) {
       pointerX = event.touches[0].pageX;
       pointerY = event.touches[0].pageY;
       } else {
       pointerX = event.touches[0].clientX;
       pointerY = event.touches[0].clientY;
       }
       } else if (event.clientX || event.clientY) {
        pointerX = event.clientX;
        pointerY = event.clientY;
       } else {
	    pointerX = event.pageX;
	    pointerY = event.pageY;
	   }
   event.target.click();
   }
 }
 
 function windowopen(pone,ptwo,pthree) {
   if (xx) {
     xx.close();
     xx=null;
   }
   if (ishover) {
     ishover=false;
     return null;
   } 
       if (event.touches) {
       if (event.touches[0].pageX) {
       pointerX = event.touches[0].pageX;
       pointerY = event.touches[0].pageY;
       } else {
       pointerX = event.touches[0].clientX;
       pointerY = event.touches[0].clientY;
       }
       } else if (event.clientX || event.clientY) {
        pointerX = event.clientX;
        pointerY = event.clientY;
       } else {
	    pointerX = event.pageX;
	    pointerY = event.pageY;
	   }
   return window.open(pone,ptwo,pthree);
 }
 
 function xxdocumentwrite(thehtml) {
   document.getElementById('dinfo').innerHTML=thehtml;
   if (xx) {
     xx.document.write(thehtml);
   }
 }
 
 function thtitleit() { 
   if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) { 
     if (document.getElementById('ic')) {
       document.getElementById('ic').style.display='none';
     }
   }
   origcmnd=document.getElementById('cmnd').value;
   var ths=document.getElementsByTagName('th'); 
   for (var ij=0; ij<ths.length; ij++) { 
     ths[ij].title=('' + ths[ij].title).replace(/\`/g,String.fromCharCode(34));  
   }  
 } 
 
 function titleme(so) { 
   if (so.value.indexOf('-mtime') != -1) {  
     so.title='find via modified time switch'; 
   } else if (so.value.indexOf('-Btime') != -1) {  
     so.title='find via file inode creation time switch'; 
   } else if (so.value.indexOf('-ctime') != -1) {  
     so.title='find via created time switch'; 
   } else if (so.value.indexOf('-atime') != -1) {  
     so.title='find via access time switch'; 
   } 
 } 
 
 function leftc(event) {
   if (!lrect) {
     lrect=event.target.getBoundingClientRect();
   }
   if (1 == 7) {
       if (event.touches) {
       if (event.touches[0].pageX) {
       pointerX = event.touches[0].pageX;
       pointerY = event.touches[0].pageY;
       } else {
       pointerX = event.touches[0].clientX;
       pointerY = event.touches[0].clientY;
       }
       } else if (event.clientX || event.clientY) {
        pointerX = event.clientX;
        pointerY = event.clientY;
       } else {
	    pointerX = event.pageX;
	    pointerY = event.pageY;
	   }
   }
 }
 
 function rightc(event) {
   if (!rrect) {
     rrect=event.target.getBoundingClientRect();
   }
       if (event.touches) {
       if (event.touches[0].pageX) {
       pointerX = event.touches[0].pageX;
       pointerY = event.touches[0].pageY;
       } else {
       pointerX = event.touches[0].clientX;
       pointerY = event.touches[0].clientY;
       }
       } else if (event.clientX || event.clientY) {
        pointerX = event.clientX;
        pointerY = event.clientY;
       } else {
	    pointerX = event.pageX;
	    pointerY = event.pageY;
	   }
 }
</scr" . "ipt>
<style>  
  #dinfo {   /* thanks to https://css-tricks.com/snippets/css/make-pre-text-wrap/ */
    background-color: #f0f0f0;
    white-space: pre-wrap;      
    white-space: -moz-pre-wrap;  
    white-space: -pre-wrap;      
    white-space: -o-pre-wrap;    
    word-wrap: break-word; 
  }
  th {
    text-align: left;
  }
  td { 
    vertical-align: top; 
  } 
  col:first-child {
    background: orange; 
  } 
  col:nth-child(2n+3) {
    background: #CCC;
  } 
</style>
</head>
<body onload=thtitleit();>
<form id=myform method=GET action=./find_minus.php><div id=dmoreform>" . $dmoreform . "</div>
<table cellpadding=5 cellspacing=5 border=20><col><col>
<tr>
<td>" . $selbit . $prego . "&nbsp;<input style=display:inline-block;background-color:lightgreen; type=submit value='Go'></input>&nbsp;&nbsp;</td>
<td style='text-align:right;'>" . $macw . "RJM Programming - March, 2022<br>Thanks to <a target=_blank title='https://www.geeksforgeeks.org/php-shell_exec-vs-exec-function/' href='//www.geeksforgeeks.org/php-shell_exec-vs-exec-function/'>https://www.geeksforgeeks.org/php-shell_exec-vs-exec-function/</a></td>
</tr>
<tr>
<th" . $toutputts . ">$" . "output = shell_exec('" . rework(str_replace("'",'"',$cmnd) . str_replace("'",'"',str_replace('  ',' +',$switch))) . "');</th>
<th" . $toutputte . ">$" . "output = exec('" . rework(str_replace("'",'"',$cmnd) . str_replace("'",'"',str_replace('  ',' +',$switch))) . "');</th>
</tr>
<tr><td id=lefttd onmouseover=leftc(event); onclick=leftc(event);><pre" . $outputts . ">$output</pre></td>
<td id=righttd onmouseover=rightc(event); onclick=rightc(event);><pre" . $outputte . ">$outpute</pre></td>
</tr>
</table>
<input type=hidden name=postswitch id=postswitch value='" . $ps . "'></input>
</form>
<br>
<pre id=dinfo></pre>
</body></html>";
?>
