Hi, im trying insert line to the end of file (data.php) and keep ?> in last place.
<?
user0:, 192.168.100.3, Prazdne, Novß ul.
user1:, 192.168.100.4, Jaro Vido,Novß ul.
?>
But i dont know how to insert line before ?>. Ex. of what i need: insert user2 following user1 and before ?>
im always getting
<?
user0:, 192.168.100.3, Prazdne, Novß ul.
user1:, 192.168.100.4, Jaro Vido,Novß ul.
?>
user2:, 192.168.100.5, PP A,Novß ul.
?>
Pls. help, peter
script writing writing:
<?php
$filename = 'users.php';
$somecontent = "user, IP, name, street". "?>";
// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {
if (!$handle = fopen($filename, 'a+')) {
echo "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent. "\n") === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
} else {
echo "The file $filename is not writable";
}
?>