hackerman Posted March 3, 2007 Report Share Posted March 3, 2007 Es gribētu ierakstīt failā post datus, bet ne tikai to ko lietotājs ir postojis, bet arī viņam neredzamo koda pusi :) Piem. input laukā lietotājs ieraksta "es macos php" un failā ierakstās kods... Man sanāca apmēram tā: $posts = $_POST['posts'] $info[] = array("text" =>"teksts", "lietataja_posts" => "$posts"); $fails = "fails.php"; $atver = fopen($fails, "a"); $raksta = fwrite($atver, $info . "\r\n"); Bet man ieraksta tikai ''array'' =/ Link to comment Share on other sites More sharing options...
bubu Posted March 3, 2007 Report Share Posted March 3, 2007 Tāpēc, ka $info IR array. Ko tu tur gribi ierakstīt? fwrite($atver, $posts . "\n"); ?? Link to comment Share on other sites More sharing options...
hackerman Posted March 3, 2007 Author Report Share Posted March 3, 2007 (edited) Tad array`us nevar ierakstīt failā? Edited March 3, 2007 by hackerman Link to comment Share on other sites More sharing options...
andrisp Posted March 3, 2007 Report Share Posted March 3, 2007 Var - tikai pirms tam tie jāpārtaisa par ne-arrayiem :). php.net/serialize, php.net/implode Link to comment Share on other sites More sharing options...
hackerman Posted March 3, 2007 Author Report Share Posted March 3, 2007 Jā...itkā vadoties pēc šī piemēra: <?php $array = array('lastname', 'email', 'phone'); $comma_separated = implode(",", $array); echo $comma_separated; // lastname,email,phone ?> Man sanāca: $server[] = array("ip" =>"$ip", "name" => "nosaukums", "ha" => "hackerman", ); $comma_separated = implode(",", $server); Bet nekas nesanāca =/ Es paņēmu nost tās kvadrātiekavas, kuras bija aiz $server un tad parādīja rezultātu: 123123123123,nosaukums,hackerman, Bet tā neder... Man vajadzētu, lai iekš faila fails.php ierakstītos pilns kods. Man nevajag lai tas array izpildās, jo failam.php vajag pilnu kodu ar svaigu post data :) Tas vispār ir iespējams? Link to comment Share on other sites More sharing options...
andrisp Posted March 3, 2007 Report Share Posted March 3, 2007 Tu laikam kaut ko šādu gribi: $server = array("ip" =>"$ip", "name" => "nosaukums", "ha" => "hackerman", ); $str = ''; foreach($server as $k => $v) { $str .= $k.' => '.$v; } Link to comment Share on other sites More sharing options...
hackerman Posted March 3, 2007 Author Report Share Posted March 3, 2007 (edited) Un kuru man no tiem mainīgajiem likt iekš fwrite(); ? $v ? edited: patestēju un laikam vienīgais, kas kautcik normāli kautko padeva bija mainīgais $str...Bet viņš nezkapē tur pa vidam bija salicis burtu "h" un dažas atstarpes bija izlaidis... Edited March 3, 2007 by hackerman Link to comment Share on other sites More sharing options...
Stopp Posted March 4, 2007 Report Share Posted March 4, 2007 Neticu. Parādi, ko viņš tev tur uztaisīja. Link to comment Share on other sites More sharing options...
hackerman Posted March 5, 2007 Author Report Share Posted March 5, 2007 Es jau izdomāju citu metodi :) Link to comment Share on other sites More sharing options...
Recommended Posts