Toon posts:

[PHP] Volgende regel schrijven

Pagina: 1
Acties:

Verwijderd

Topicstarter
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?
 
$date = "Data/05.txt"; 
$call = getenv(REMOTE_ADDR); 
$ipad = "Data/06.txt"; 

$fp = fopen($date, "r");  
while ( ! feof ($fp) ) {  
    $hoeveel = fgets ($fp,1024);  
}  
$actueel=$hoeveel+1;  
fclose($fp);  

$fp2 = fopen($date, "w");  
fwrite($fp2,$actueel);  
fclose($fp2);  

$fp3 = fopen($ipad, "w");  
fwrite($fp3,"\n $call");  
fclose($fp3);  
?> 
<? 
header("Location: $file");  
?>

hoe zorg ik (in dat laatste stukje dat hij het ipadres niet steeds over het oude gegeven heen schrijft maar gewoon eerst het eerste ip adres dat hij krijgt volgende regel 2de volgende regel 3de etc etc. :?

  • Orphix
  • Registratie: Februari 2000
  • Niet online
Je moet een andere mode gebruiken:
'r' - Open for reading only; place the file pointer at the beginning of the file.

'r+' - Open for reading and writing; place the file pointer at the beginning of the file.

'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

'w+' - Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.

'a+' - Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
bron php.net

Verwijderd

Topicstarter
Op zondag 02 december 2001 18:57 schreef Orphix het volgende:
Je moet een andere mode gebruiken:
[..]

bron php.net
sorry zag het ook net