Click to See Complete Forum and Search --> : Passing data and adding to it !


Peuplarchie
05-21-2007, 09:00 PM
Good day to you all,
The code below extract from a form some data and add it to a html file.'
My problem is , I would need to copy the code after a certains page, also I need to put some logs in it to seperate. ex : time, ip, name, number of line, image, ......

Can you please help me ?!?!?!?!?!:confused:






<?php
echo "copiage de fichier debut";
// your new data + newline
$new_line = stripslashes($_POST['codesource'])."\n\r";
// the filepath
$file = 'upload/aaatest.html';
// the old data as array
$old_lines = file($file);
// add new line to beginning of array
array_unshift($old_lines,$new_line);
// make string out of array
$new_content = join('',$old_lines);
$fp = fopen($file,'w');
// write string to file
$write = fwrite($fp, $new_content);
fclose($fp);
echo "copiage de fichier Fin";
echo "Redirection.....";
?>