Peuplarchie
07-08-2007, 05:26 AM
Salut !
Here is a piece of code which it bring me to drink..lol
I need to find the error, it don't give me an error but it don't copy "codesource" to "http://rsv.peuplies.info/2007/".$data"
Can somebody help me on this ?
Thanks to viewers and those who take their time to help me on my many questions !!!1
<?php
// set file to read
$file = 'choix_message.txt' ;
// read file into string
$data = file_get_contents($file) or die('Could not read file!');
echo "copiage de fichier debut"."\n\r";
$strip = stripslashes($_POST['codesource']);
$file="http://rsv.peuplies.info/2007/".$data";//define the file to open
$lines=file($file);//load the lines to an array
$insert_line = 75;//the line to insert at...could be a post variable
$insert_text = $strip ."\n\r";
//this could be a post variable, but at any case make sure to append the var with the new line, otherwise it will run together
$temp="";//start a temp variable to work with
$count=1;//initialize a counter
foreach($lines as $line){
($count != $insert_line) ? $temp .= $line : $temp .= $insert_text . $line;
$count++;
}
$fp = fopen($file,'w');
// write string to file
$write = fwrite($fp, $temp);
fclose($fp);
echo "\n\r"."copiage de fichier Fin"."\n\r";
echo "\n\r"."Redirection en-cours ......"."\n\r";
fclose($fp);
?>
Here is a piece of code which it bring me to drink..lol
I need to find the error, it don't give me an error but it don't copy "codesource" to "http://rsv.peuplies.info/2007/".$data"
Can somebody help me on this ?
Thanks to viewers and those who take their time to help me on my many questions !!!1
<?php
// set file to read
$file = 'choix_message.txt' ;
// read file into string
$data = file_get_contents($file) or die('Could not read file!');
echo "copiage de fichier debut"."\n\r";
$strip = stripslashes($_POST['codesource']);
$file="http://rsv.peuplies.info/2007/".$data";//define the file to open
$lines=file($file);//load the lines to an array
$insert_line = 75;//the line to insert at...could be a post variable
$insert_text = $strip ."\n\r";
//this could be a post variable, but at any case make sure to append the var with the new line, otherwise it will run together
$temp="";//start a temp variable to work with
$count=1;//initialize a counter
foreach($lines as $line){
($count != $insert_line) ? $temp .= $line : $temp .= $insert_text . $line;
$count++;
}
$fp = fopen($file,'w');
// write string to file
$write = fwrite($fp, $temp);
fclose($fp);
echo "\n\r"."copiage de fichier Fin"."\n\r";
echo "\n\r"."Redirection en-cours ......"."\n\r";
fclose($fp);
?>