Ciao a tutti,
generando un file con file_put_contents e poi farlo vedere sulla pagina tutto bene.
se però vado ad aprire il file con nano su linux mi fa vedere uno spazio in piu!!
cosa fa lo script:
1 va a prendere dei valori nel db, (ci sono anche campi vuoti forse ö per questo).
2 con un while creo le righe da salvare nel file
3 con file_put_contents scrivo il file
ora dal web vedo giusto per esempio:
{1spazio}
nel file con nano vedo:
{2spazi}
e non capisco come risolvere:
Codice PHP:
mysql_select_db($database_name, $conn);
$sql_makecfg="SELECT * FROM cccam_fline WHERE cccam_fline.fline_active = '1'";
$query_makecfg=mysql_query($sql_makecfg) or die (mysql_error());
$data = date("d-m-Y, g:i a");
$testo1 = "####################################\n";
$testo1 .= "# CCcam Config generato il : $data #\n";
$testo1 .= "####################################\n";
$testo1 .= "\n";
$testo1 .= "################\n";
$testo1 .= "### User ###\n";
$testo1 .= "################\n";
$testo1 .= "\n";
file_put_contents('CCcam.cfg',$testo1, FILE_APPEND);
while($result_makecfg=mysql_fetch_assoc($query_makecfg)) {
if($result_makecfg['fline_limit'] == "") {
$virg = "";
} else {
$virg = ", ";
}
$testo = "F: " . $result_makecfg['cc_user'] . " " . $result_makecfg['cc_pwd'] . " " . $result_makecfg['cc_Hop'] . " " . $result_makecfg['cc_Emu'] . " " . $result_makecfg['cc_Emm'] . " { " . $result_makecfg['cc_Reshare'] . $virg . $result_makecfg['fline_limit'] . " }" . " { " . $result_makecfg['chan_limit'] . " }" . " { " . $result_makecfg['time_limit'] . " }" . " " . $result_makecfg['hostname_limit'] . "\n";
file_put_contents('CCcam.cfg',$testo, FILE_APPEND);
questo campo nel db é quasi su tutti impostato su vuoto, può essere questa la causa?
" { " . $result_makecfg['chan_limit'] . " }"