Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> edycja pliku ... problem :(
Fo
post 10.09.2003, 17:51:50
Post #1





Grupa: Zarejestrowani
Postów: 401
Pomógł: 0
Dołączył: 18.04.2003
Skąd: Trójmiasto

Ostrzeżenie: (0%)
-----


witam,

mam taki kodzik : [php:1:2c968978b3]<?
$sciezka = "/home/www/plik.txt";
?>
<pre>
<?php
if( empty( $_POST['file'] ) )
{
?>
<form method="post" >
<input type="hidden" name="file" value="<?=$sciezka; ?>">
<input type="submit" value="Edytuj dane" />
</form>
<?php
}
else
{
$strFile = $_POST['file'];

if( !file_exists( $strFile ) )
{
die( 'Plik nie istnieje!' );
}

if( empty( $_POST['contents'] ) )
{
$strContents = file_get_contents( $strFile );
$strFile = stripslashes( $strFile );
?>
<form method="post">
Edycja pliku <?php echo $strFile ?>:<br />
<textarea name="contents" cols="100" rows="25"><?php echo $strContents ?></textarea>
<input type="hidden" name="file" value="<?php echo $strFile ?>" />
<input type="submit" value="Zapisz zmiany" />
</form>
<?php
}
else
{
$strContents = stripslashes( $_POST['contents'] );

$fp = fopen( $strFile, 'w' );

if( $fp )
{
flock( $fp, 2 );
fputs( $fp, $strContents );
flock( $fp, 3);
fclose( $fp );

echo 'Zmiany zostały zapisane!';
echo "<br><br><a href=# onclick=java script:window.close()><input type=button value=Zamknij></a>";
}
else
{
echo 'Otwarcie pliku do zapisu nie powiodło sie!';
}
}
}
?>
</pre>[/php:1:2c968978b3] no i cos on nie chce zabardzo dzialac na linuxie.. tzn. u mnie na lokalu dziala bardzo ladnie (thx Cudi) ale na linuxie juz sie wykrzacza sad.gif i niewiem co z tym mozna by zrobic... a najlepsze jest to ze nie ma zadnego bledu tylko pusta strona sad.gif
Go to the top of the page
+Quote Post
kwiateek
post 10.09.2003, 18:08:55
Post #2





Grupa: Zarejestrowani
Postów: 223
Pomógł: 0
Dołączył: 13.01.2003
Skąd: 3rd ball of mud behind a big ball of burning gas

Ostrzeżenie: (0%)
-----


Daj na samym początku kodu [php:1:0924411e0f]<?php
error_reporting(E_ALL);
?>[/php:1:0924411e0f] i spradź czy nie pojawiają się błędy.

Pozdrawiam.


--------------------
It's Time to Join the PLD Linux Generation!
<? while (!$success) { $try++; } ?>
Go to the top of the page
+Quote Post
Fo
post 10.09.2003, 18:12:55
Post #3





Grupa: Zarejestrowani
Postów: 401
Pomógł: 0
Dołączył: 18.04.2003
Skąd: Trójmiasto

Ostrzeżenie: (0%)
-----


serio : dalej sie nic nie pojawia ... niewiem co jest nie tak.. powinien byc jakis kod bledu... a tu pusto sad.gif
Go to the top of the page
+Quote Post
spenalzo
post 10.09.2003, 18:26:13
Post #4





Grupa: Zarejestrowani
Postów: 2 064
Pomógł: 1
Dołączył: 22.01.2003
Skąd: Poznań

Ostrzeżenie: (0%)
-----


[manual:130e1df82e]file_get_contents[/manual:130e1df82e] występuje od php >= 4.3.0


--------------------

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 23.06.2025 - 07:09