rudzis Posted March 20, 2004 Report Share Posted March 20, 2004 Yo! Kaadam nav azotee kaads padoms, kaa pievienojot infu txt failam, taa pievienotos nevis beigaas, bet jaunaakie posti rindotos pashaa augshaa??? ;) Tad veel taada lieta, vai var noraaditt - kuru konkreeti rindinju izdezeest, vai pat labaakajaa gadiijumaa atrast noteiktu rindinju (resp. IP adresi), kuru izmest no txt faila? :) Link to comment Share on other sites More sharing options...
Gacha Posted March 20, 2004 Report Share Posted March 20, 2004 A, kapēc tu neizmanto mysql? Tur tas ir daudz vienkāršāk! Link to comment Share on other sites More sharing options...
rudzis Posted March 20, 2004 Author Report Share Posted March 20, 2004 Mysql neatbalsta tas servaks Link to comment Share on other sites More sharing options...
bubu Posted March 20, 2004 Report Share Posted March 20, 2004 a sqlite neder? Link to comment Share on other sites More sharing options...
Aleksejs Posted March 20, 2004 Report Share Posted March 20, 2004 Pieņemot, ka tā rindiņa atrodas mainīgajā $rindiņa atver failu rakstīšanai ielasi saturu mainīgajā $teksts echo failā $rindiņa . $teksts Link to comment Share on other sites More sharing options...
Gacha Posted March 20, 2004 Report Share Posted March 20, 2004 Agrāk kad ņēmos ar text failiem palasiju šito un man tur daudz kas palīdzēja. Varbūt tev arī! P.S Tam turtoram ir 2 daļas Link to comment Share on other sites More sharing options...
Lokomotive Posted March 21, 2004 Report Share Posted March 21, 2004 (edited) Lai varētu rakstīt TXT failā, pirms fwrite komandas (rakstīt) ir jārada savienojums ar failu, lietojot fopen. Tātad fopen ir vairākas modes: r r+ w w+ a a+ x x+ tā piemēram r+ mode atļauj rakstīt failā un novieto kursoru faila sākumā. šķiet, ka tev derēs tieši ši mode. Piemērs: <?php $ip = getenv ("REMOTE_ADDR"); $write_ip = "$ip\n"; $connect = fopen('log.txt','r+'); fwrite($connect, $write_ip); fclose($connect); ?> Edited March 21, 2004 by Lokomotive Link to comment Share on other sites More sharing options...
rnc Posted March 22, 2004 Report Share Posted March 22, 2004 Izdzeest konkreetu rindu: <?php // padodam mainiigo $rinda (rinda kuru izdzeest) $f = file('fails.txt'); foreach ($f as $ff) { if($ff != $f[$rinda-1]) $newmas[] = trim($ff); } $o = fopen('fails.txt','w'); fwrite ($o,join("\n",$newmas)); fclose ($o); ?> Atrast IP un izdzeest: <?php // padodam mainiigo $ip (mekleejamaa/dzeeshamaa ip adr) $ipf = file('ip.txt'); foreach ($ipf as $srch) { if(trim($srch) != $ip) $iptb[] = trim($srch); else $todel = true; } if ($todel == true) { $op = fopen('ip.txt','w'); fwrite ($op,join("\n",$iptb)); fclose ($op); echo 'ip tika atrasts un izdzeests'; } else echo 'ip netika atrasts'; ?> Link to comment Share on other sites More sharing options...
Recommended Posts