briedis Posted December 22, 2010 Report Share Posted December 22, 2010 varbūt tu nemaz nepadod to faila nosaukumu kā get mainīgo, bet kā post? Varbūt vnk parādi kopējo plānu, citādi tev ar atkļūdošanu pavisam sūdīgi iet... Quote Link to comment Share on other sites More sharing options...
-=HELLBENDER=- Posted December 22, 2010 Author Report Share Posted December 22, 2010 http://www.failiem.lv/list.php?i=vmirms Quote Link to comment Share on other sites More sharing options...
mounkuls Posted December 22, 2010 Report Share Posted December 22, 2010 (edited) Nezinu vai sapratu, bet pamēģini bez PHP_SELF un readfile() vietā iebliez pa tiešo failu. Tādā variantā kā readfile($_GET['file']); , tā ir totālākā pašnāvība. Edited December 22, 2010 by mounkuls Quote Link to comment Share on other sites More sharing options...
briedis Posted December 22, 2010 Report Share Posted December 22, 2010 Nu un interesanti, kā jau minēju augstāk, kur tiek padots formā šis? $_GET["fname"] Quote Link to comment Share on other sites More sharing options...
mounkuls Posted December 22, 2010 Report Share Posted December 22, 2010 arī fakts, faila nosaukumu jau dod kā POST, tātad nesaņem kā $_GET['fname'] nemaz. Quote Link to comment Share on other sites More sharing options...
-=HELLBENDER=- Posted December 22, 2010 Author Report Share Posted December 22, 2010 Īsti nesaprotu ko tu ar to domāji, bet nu izskatās šādi un kļūda nemainīga; <?php $fn = $_GET["fname"]; var_dump($_GET["fname"]); if (isset($_GET['content'])) { $fn = $_GET["fname"]; if (file_exists($fn)) { echo "The file $filename exists<p>"; } else { echo "The file $filename does not exist<p>"; } var_dump($_GET["fname"]); $fp = file_get_contents($fn, true) or die ("Error opening file in write mode!"); file_put_contents($fp,$content); } ?> <p> <form action="edit.php" method="get"> <textarea rows="30" cols="80" name="content"><?php readfile($fn); ?></textarea> <input type="submit" value="Edit"> </form> Quote Link to comment Share on other sites More sharing options...
mounkuls Posted December 22, 2010 Report Share Posted December 22, 2010 (edited) Ko Tu nesaproti? Pirmajā postā kur ieliki kodu, Tu to padod ar POST mainīgo "fname" un saņemt nez kāpēc centies ar $fn = $_GET['fname']; Kā Tev liekas, bez register globals on tas darbojas? EDIT: un jā, tikai nemēģini to register globals on panākt, emm..,uzstādijumos...,iestatījumos, kā pareizāk, nezinu. Edited December 22, 2010 by mounkuls Quote Link to comment Share on other sites More sharing options...
-=HELLBENDER=- Posted December 22, 2010 Author Report Share Posted December 22, 2010 Kur tu redzi ka es ar post padodu fname? Quote Link to comment Share on other sites More sharing options...
mounkuls Posted December 22, 2010 Report Share Posted December 22, 2010 OK, es nepamaniju, nemēdzu skatīt kodu vairakreiz. Bet Tu vismaz pamēģināji iztikt bez PHP_SELF un fails, kurā ar to operē tiešām saucas edit.php? Quote Link to comment Share on other sites More sharing options...
-=HELLBENDER=- Posted December 22, 2010 Author Report Share Posted December 22, 2010 Jā. http://www.failiem.lv/list.php?i=vmirms Quote Link to comment Share on other sites More sharing options...
briedis Posted December 22, 2010 Report Share Posted December 22, 2010 nu ok, bet kur tu otrā formā padod to get mainīgo?? Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted December 22, 2010 Report Share Posted December 22, 2010 (edited) Debugo lēnām un mierīgi. Ko saka file_exists? Ja false, tad skaties vai failu meklē pareizajā ceļā (ja taisi file_get_contents('file.php') nevis file_get_contents('/path/to/file.php'), tad skaties, kura ir pašreizējā direktorija no kuras php mēģinās to failu atrast) Un jā - tev tas fname ir urlī? Edited December 22, 2010 by rATRIJS Quote Link to comment Share on other sites More sharing options...
mounkuls Posted December 22, 2010 Report Share Posted December 22, 2010 Gribi lai es tagad lejupielādēju failu no kāda tur failiem.lv? Danke schõn, aber das ist nicht fūr misch Quote Link to comment Share on other sites More sharing options...
-=HELLBENDER=- Posted December 22, 2010 Author Report Share Posted December 22, 2010 Un jā - tev tas fname ir urlī? Jā.. Un par tiem exists jau minēju iepriekš. Sākumā, kad nolasa failu/saturu tajā, failu atrod, bet kad uzspiežu uz pogas Edit, fails vairs nepastāv. Un kā php ieslēgt debugging mode? Quote Link to comment Share on other sites More sharing options...
mounkuls Posted December 22, 2010 Report Share Posted December 22, 2010 (edited) Failam ir jābūt, pat ja lieto 'w' opciju fopen, failu iztukšo un raksta no jauna. Pat ja neko neieraksta, failam ir jāpastāv. Bet nu debugging mode jau ir smadzenēs. echo 'step' un print_r(vars) apmēram ini_set('display_errors', 1); Edited December 22, 2010 by mounkuls Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.