Jump to content
php.lv forumi

Kļūda izmantojot fopen (php $_GET)


-=HELLBENDER=-

Recommended Posts

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Tev sanāk file_exists("file")=false ? Tā nevar būt, ja vien nav kur unlink("file");

Ak jā, nav gadījumā tā, ka to failu meklē jau pirms esi izveidojis kādam jūzerim vai figviņzin kam?

Bet vispār ieliec to kodu kaut vai paste.php.lv nevis failiem.lv lai var paskatīties.

Edited by mounkuls
Link to comment
Share on other sites

Warning: file_put_contents(<form action="edit.php" method="get"> Name: <input type="text" name="fname" /> <input type="submit" /> </form> ....) [function.file-put-contents]: failed to open stream: Invalid argument in edit.php on line 6

 

Pašlaik izskatās šādi;

<?php

$fn = $_REQUEST["fname"];

if (isset($_POST['content']))

{

$fp = file_get_contents($fn, true) or die ("Error opening file in write mode!");

file_put_contents($fp,$content);

}

?>

<p>

<form action="<?php echo $_SERVER["PHP_SELF"]."?fname=".$fn ?>" method="post">

<textarea rows="30" cols="80" name="content"><?php readfile($fn); ?></textarea>

<input type="submit" value="Edit">

</form>

Sestā līnija izcelta.

ps. Warning'ā ir redzams atvērtā (fname) faila saturs.

Edited by -=HELLBENDER=-
Link to comment
Share on other sites

+ $fp satur faila saturu :D

 

Laikam jāieliek parakstā - "pirms prasi forumā vai debugoji (<- latviski būtu kā?) savu veikumu?"

*facepalm*.. Paldies.

 

Lai nu kā, nākamā problēma;;

Faila saturs pirms edit'a;

<form action="edit.php" method="get">

Name: <input type="text" name="fname" />

<input type="submit" />

</form>

 

Faila saturs pēc trijiem editiem (neko nemainot);

 

<form action=\\\\\\\"edit.php\\\\\\\" method=\\\\\\\"get\\\\\\\">

Name: <input type=\\\\\\\"text\\\\\\\" name=\\\\\\\"fname\\\\\\\" />

<input type=\\\\\\\"submit\\\\\\\" />

</form>

 

Kapēc veidojās tie liekie \\ ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...