Chciałbym dodać adresy IP z jednego pliku php do .htaccess. Znalazłem taki tutorial ale coś nie działa - http://www.learncomputer.com/php-insert-te...le-at-position/
<?php function insert_into_file($file_path, $insert_marker, $text, $after = true) { ($after) ? '$0' . $text : $text . '$0', $contents); return file_put_contents($file_path, $new_contents); } $file_path = ".htaccess"; $insert_marker = "<Files *.php>"; $num_bytes = insert_into_file($file_path, $insert_marker, $text, true); if ($num_bytes === false) { } else { } ?>
Chciałbym dodać zawartość IPs.php do .htaccess zaraz za <Files *.php>
Kod zwraca Insert successful! ale .htaccess jest nietknięty.
Nawet takie coś nie działa:
function insert_into_file($file_path, $insert_marker, $text, $after = true) { ($after) ? '$0' . $text : $text . '$0', $contents); return file_put_contents($file_path, $new_contents); } $file_path = ".htaccess"; $insert_marker = "<Files *.php>"; $text = "0000000"; $num_bytes = insert_into_file($file_path, $insert_marker, $text, true); if ($num_bytes === false) { } else { }