"; 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'])); $ok=false; //for ($i=0; $i" . $np . "" . str_replace("","",""); } $switch.=$np; } else if (isset($_POST['nprefix'])) { $np=str_replace(' ','+',urldecode($_POST['nprefix'])); if (strlen($np) != '') { $nprefix="" . str_replace("","",""); } $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'])); } } $selbit=$cmnd . "   "; for ($i=1; $i', '', $selbit); } } if ($cmdtitlesuffix != '') { $toutputte=" onmouseout='setTimeout(onmout,2000);' onmouseover=onmo(event); onclick=\" xx=windowopen('','_blank','top=50,left=50,height=600,width=600'); xxdocumentwrite('

' + this.title + '

' + '" . str_replace("\n","
",exec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlesuffix)) . "' + '


' + '

'); xx.document.title=this.title;\" id=thl title=\"\$outputte = exec('" . str_replace("'",'`',$cmnd) . 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('

' + this.title + '

' + ldebate('" . str_replace("\n","
",shell_exec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlesuffix)) . "') + '

' + '

'); xx.document.title=this.title;\" id=thr title=\"\$outputts = shell_exec('" . str_replace("'",'`',$cmnd) . 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('

' + this.title + '

' + '" . str_replace("\n","
",exec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlefilesuffix)) . "' + '


' + '

'); xx.document.title=this.title;\" id=thld title=\"\$outputfilete = exec('" . str_replace("'",'`',$cmnd) . 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('

' + this.title + '

' + ldebate('" . str_replace("\n","
",shell_exec($cmnd . str_replace(' ',' +',$switch) . $cmdtitlefilesuffix)) . "') + '

' + '

'); xx.document.title=this.title;\" id=thld title=\"\$outputfilets = shell_exec('" . str_replace("'",'`',$cmnd) . str_replace(' ',' +',$switch) . $cmdtitlefilesuffix . "');" . "\" "; } $outpute = str_replace("\n", "
", exec($cmnd . str_replace(' ',' +',$switch))); $output = str_replace("\n", "
", shell_exec($cmnd . str_replace(' ',' +',$switch))); // Display the list of all file // and directory, if chosen echo "find_minus.php - PHP Supervise find or dir var xx=null; var ishover=false; var lrect=null; var rrect=null; var pointerX=-1; var pointerY=-1; function ldebate(inh) { var outh=inh; var outlines=inh.replace(/\$/g,'').split('
'); 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], '' + outlines[vsi] + ''); } } return outh; } function onmout(one) { if (xx && ishover) { ishover=false; xx.close(); xx=null; } } function onmo(event) { if (document && ('' + event.target.outerHTML).indexOf('') != -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() { var ths=document.getElementsByTagName('th'); for (var ij=0; ij
$" . "output = shell_exec('" . str_replace("'",'"',$cmnd) . str_replace(' ',' +',$switch) . "'); $" . "output = exec('" . str_replace("'",'"',$cmnd) . str_replace(' ',' +',$switch) . "');
" . $selbit . "    RJM Programming - March, 2022
Thanks to https://www.geeksforgeeks.org/php-shell_exec-vs-exec-function/
$output $outpute


";
?>