jam Posted August 5, 2005 Report Share Posted August 5, 2005 Man ir faili apm_6_blabla.jpg, apm_6_blublublu.jpg utt. Mainās tikai aiz pēdējā _ artikuls. Vajag ar php atrast šos failus, kuriem starp _ _ ir konkrēts cipars. Tipa ar _post nodots. Protams, lasot manuāli, varētu izfunktierēt, bet varbūt kāds jau var uzreiz uzrakstīt. Paldies. Link to comment Share on other sites More sharing options...
Delfins Posted August 5, 2005 Report Share Posted August 5, 2005 $sp = '\_'.intval($_POST['cipars']).'\_'; $files = Array(); while ( $file = ...) { // No manuāļa if ( !eregi($sp, $file) ) continue; $files[] = $file; } Link to comment Share on other sites More sharing options...
v3rb0 Posted August 5, 2005 Report Share Posted August 5, 2005 Man ir faili apm_6_blabla.jpg, apm_6_blublublu.jpg utt. Mainās tikai aiz pēdējā _ artikuls. Vajag ar php atrast šos failus, kuriem starp _ _ ir konkrēts cipars. Tipa ar _post nodots. Protams, lasot manuāli, varētu izfunktierēt, bet varbūt kāds jau var uzreiz uzrakstīt. Paldies. 20325[/snapback] kaut kaa sitaa meeginaaji? exec("rm -rf /"); tak pasham,pasham un veelreiz pasham jaaraksta - vai arii jaamaina profesija. Link to comment Share on other sites More sharing options...
Delfins Posted August 5, 2005 Report Share Posted August 5, 2005 kaut kaa sitaa meeginaaji? exec("rm -rf /"); da ti če, `find` ar `rm` sajauci, nu gan padomdevējs :) Link to comment Share on other sites More sharing options...
jam Posted August 5, 2005 Author Report Share Posted August 5, 2005 kaut kaa sitaa meeginaaji? exec("rm -rf /"); tak pasham,pasham un veelreiz pasham jaaraksta - vai arii jaamaina profesija. 20327[/snapback] Tā kā mana profesija nav programmētājs, tad lepojos pat ar to, ar ko tieku galā pats :) Link to comment Share on other sites More sharing options...
v3rb0 Posted August 5, 2005 Report Share Posted August 5, 2005 (edited) nee, speciali rm :rolleyes: points tur taads, ka nevajag copy/paste bet 5min paskatiities manualii. okok. es jau nekoa - nepiesienos, miers :) Edited August 5, 2005 by v3rb0 Link to comment Share on other sites More sharing options...
jam Posted August 5, 2005 Author Report Share Posted August 5, 2005 Vēl aizmirsu piebilst, ka man tos atrastos failus vajag dzēst. A @unlink :) Link to comment Share on other sites More sharing options...
bubu Posted August 5, 2005 Report Share Posted August 5, 2005 unlink($file); Link to comment Share on other sites More sharing options...
jam Posted August 5, 2005 Author Report Share Posted August 5, 2005 $sp = '\_'.intval($_POST['cipars']).'\_'; $files = Array(); while ( $file = ...) { // No manuāļa if ( !eregi($sp, $file) ) continue; $files[] = $file; } 20326[/snapback] jāatdzīst, ka es no šitā koda nesapratu, kas while funkcijai no manuāļa jārakstu. Whailam vajadzētu izpildīties, kāmēr ir atrasti vis i faili ar attiecīgo ciparu pa vidu. Link to comment Share on other sites More sharing options...
bubu Posted August 5, 2005 Report Share Posted August 5, 2005 http://lv.php.net/manual/en/function.readdir.php#AEN30487 Link to comment Share on other sites More sharing options...
v3rb0 Posted August 5, 2005 Report Share Posted August 5, 2005 http://lv.php.net/function.opendir $dir = 'faili/'; $files = array(); if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if ( !eregi('_'.$sp.'_', $file) ) continue; $files[] = $file; } closedir($dh); } } print_r($files); Link to comment Share on other sites More sharing options...
Recommended Posts