drinkits Posted July 11, 2006 Report Share Posted July 11, 2006 Vot man ir jautaajums atkal par demo... Luk apakshaa ir php skripts kas panjem demo kas ir .demo formaataa paartaiasa par tar.gz, vopshem vai kaads nevar sho skriptu bish palabnot lai tas kompresee shos demo automaatiski ik peec 30 min liidziigi kaa GIGN un un ciaam adreseem. Buushu Ljoti pateiciigs <?php function gzcompressfile($source,$destination,$filename,$level=false) { $dest=$destination.$filename.'.gz'; $mode='wb'.$level; $error=false; echo $source.$filename.' -> '.$dest.'<br>'; if($fp_out=gzopen($dest,$mode)) { if($fp_in=fopen($source.$filename,'rb')) { while(!feof($fp_in)) { gzwrite($fp_out,fread($fp_in,1024*512)); } fclose($fp_in); } else { $error=true; } gzclose($fp_out); } else $error=true; if($error) return false; else return $dest; } $demo_dir = 'C:/'; // Mape, kuraa ir .dem faili $dl_dir = 'C:/'; // Mape, kuraa likt saarhiveetos failus $handle = opendir($demo_dir); if ($handle) { while (false !== ($fails = readdir($handle))) { if ( preg_match("/(.*).dem/", $fails, $demo) ) { gzcompressfile($demo_dir, $dl_dir, $fails); } } closedir($handle); } ?> P.S. Atvainosjos par garo kodu! Link to comment Share on other sites More sharing options...
Troxy Posted July 12, 2006 Report Share Posted July 12, 2006 Lieto Tasks Scheduled Link to comment Share on other sites More sharing options...
KillYou Posted July 12, 2006 Report Share Posted July 12, 2006 es domāju kad varētu tev mēģināt palīdzēt, bet īsti nesaprotu ko tu gribi panākt. izskaidro sīkāk, jo es nezinu kā GIGN ir? Link to comment Share on other sites More sharing options...
drinkits Posted July 12, 2006 Author Report Share Posted July 12, 2006 es domāju kad varētu tev mēģināt palīdzēt, bet īsti nesaprotu ko tu gribi panākt. izskaidro sīkāk, jo es nezinu kā GIGN ir? vnk lai tas skripts stradatu pats automaatiski ik peec 30 min nevis ka pashama jaapalaizh atverot failu Link to comment Share on other sites More sharing options...
worm Posted July 12, 2006 Report Share Posted July 12, 2006 Ja tev ir linux, tad pameklee googlee 'howto crontab', ja tev ir windoze, tad Start->Programms->Accessories->System Tools->Scheduled Tasks Link to comment Share on other sites More sharing options...
drinkits Posted July 12, 2006 Author Report Share Posted July 12, 2006 Ja tev ir linux, tad pameklee googlee 'howto crontab', ja tev ir windoze, tad Start->Programms->Accessories->System Tools->Scheduled Tasks eas domaaju kaa pashu php skriptu paartaisiit lai tas ik peec 30 min skaneetu to demo failus kas atrodas noteiktaa maopee un ieliktu citaa noteiktaa mapee kas atrodas www Link to comment Share on other sites More sharing options...
drinkits Posted July 13, 2006 Author Report Share Posted July 13, 2006 nu to fail;u jaaver caur browseri lai tie demo sakompreswetos, bet kaads nevar to skrptu paartaisiit lai automaatiski tas ik peec 30 min skenee noteiktu mapi ar demo failiem Link to comment Share on other sites More sharing options...
x-tomy91-x Posted July 13, 2006 Report Share Posted July 13, 2006 nu to fail;u jaaver caur browseri lai tie demo sakompreswetos, bet kaads nevar to skrptu paartaisiit lai automaatiski tas ik peec 30 min skenee noteiktu mapi ar demo failiem A varbuut tas nav iespeejams! Taa sapsieshana notiek tikai tad, ja to failu atver! Ja jau worms teica, ka taa jaadara, tad skaidrs! Link to comment Share on other sites More sharing options...
drinkits Posted July 13, 2006 Author Report Share Posted July 13, 2006 A varbuut tas nav iespeejams! Taa sapsieshana notiek tikai tad, ja to failu atver! Ja jau worms teica, ka taa jaadara, tad skaidrs! worms vnk paarpratu, vinsh nezinaaja ka tas php fails caur i-paarluuku jaaver un ko piekasies, nu davai kaads atbild, tak jaabut kaadam kas par php labi kozh, vislaabaak buutu jka to paeiktu to kas sho skrptu raksiitjis Link to comment Share on other sites More sharing options...
valchers Posted July 13, 2006 Report Share Posted July 13, 2006 (edited) kur tu šo skriptu dabūji un vai vari pastāstīt kā viņš pašreiz strādā? Edited July 13, 2006 by valchers Link to comment Share on other sites More sharing options...
KillYou Posted July 13, 2006 Report Share Posted July 13, 2006 (edited) tomēr nesapratu, bet stāstīshu kā es sapratu: tur varētu izmantot skripta beigās funkciju sleep(); un tad ar meta tagu lai redirektētu tas viss sanāks tā: atverot šo failu PHP izpildīs visas skripta funkcijas, tad ar sleep(); nogaidīs 1800 sekundes(30 min.) un ar meta tagu redirektēs uz topašu failu. <?php ? function gzcompressfile($source,$destination,$filename,$level=false) ? { ? ? ? $dest=$destination.$filename.'.gz'; ? ? ? $mode='wb'.$level; ? ? ? $error=false; ? ? ? ? ? echo $source.$filename.' -> '.$dest.'<br>'; ? ? ? if($fp_out=gzopen($dest,$mode)) ? ? ? { ? ? ? ? ? if($fp_in=fopen($source.$filename,'rb')) ? ? ? ? ? { ? ? ? ? ? ? ? while(!feof($fp_in)) ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? gzwrite($fp_out,fread($fp_in,1024*512)); ? ? ? ? ? ? ? } ? ? ? ? ? ? ? fclose($fp_in); ? ? ? ? ? } ? ? ? ? ? else ? ? ? ? ? { ? ? ? ? ? ? ? $error=true; ? ? ? ? ? } ? ? ? ? ? gzclose($fp_out); ? ? ? } ? ? ? else $error=true; ? ? ? if($error) return false; ? ? ? else return $dest; ? } ? $demo_dir = 'C:/'; // Mape, kuraa ir .dem faili ? $dl_dir = 'C:/'; // Mape, kuraa likt saarhiveetos failus ? ? $handle = opendir($demo_dir); ? ? ? if ($handle) ? { ? ? ? while (false !== ($fails = readdir($handle))) ? ? ? { ? ? ? ? ? if ( preg_match("/(.*).dem/", $fails, $demo) ) ? ? ? ? ? { ? ? ? ? ? ? ? gzcompressfile($demo_dir, $dl_dir, $fails); ? ? ? ? ? } ? ? ? } ? ? ? closedir($handle); ? } sleep(1800); ?> <meta http-equiv="Refresh" content="0;URL=#" /> kautgan īstenībā droši vari neizmantot funkciju sleep(); jo meta piedava uzstādī pec cik sek. izdarīt komandu. Ceru, kad tā tu biji domājis... Edited July 13, 2006 by KillYou Link to comment Share on other sites More sharing options...
drinkits Posted July 14, 2006 Author Report Share Posted July 14, 2006 bet mosh var idarit taa ka shis fails nav jaatver bet automaatiski pats ik pec 30 min palaizhas Link to comment Share on other sites More sharing options...
KillYou Posted July 14, 2006 Report Share Posted July 14, 2006 Sāku domāt kad tad tas tev nav jādara caut PHP jo PHP šādu iespēju diezvai piedāvā, vismaz es tādu nezinu... Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now