cmq la pag asp x poter aggiungere dei dati in un file di nome testo.txt
sarà una cosa del genere
Codice PHP:
<%@ Language=JavaScript %>
<%
var to_do = String(Request("to_do"));
var this_script_url = String(Request.ServerVariables("SCRIPT_NAME"));
// Se la variabile "to_do" è stata impostata creo un file system
// object che servirà per scrivere all'interno del file testo.txt
// che è il file che memorizza le var.
var guest_book_file = "testo.txt";
// setto il percorso assoluto del file
var abs_path = String(Request.ServerVariables("PATH_TRANSLATED"));
// apro il file messaggi.xml che è stato messo nella variabile "guest_book_file"
var file_to_open = abs_path.replace(/\\\w*\.asp/,"\\") + guest_book_file;
fso = new ActiveXObject("Scripting.FileSystemObject");
// Verifico se il file da aprire effettivamente esiste, se si procedo con la procedura di inserimento
if (fso.FileExists(file_to_open)){
////////////////////////////////////////////////////////////////////
// Se la variabile "to_do" è settata sul valore "add_entry"
// bisogna inserire i nuovi dati relativi alla firma del visitatore
if (to_do == "add_entry"){
// creo TextStream object in appending mode, ovvero aggiungo in coda i nuovi dati
var ForReading = 1, ForWriting = 2, ForAppending = 8;
fs_stream = fso.OpenTextFile(file_to_open,ForAppending);
// Ecco i dati che sono pervenuti: testo1 e testo2
var testo1,testo2;
var testo1 = String(Request("testo1"));
var testo2 = String(Request("testo2"));
// Creo la stringa che dovrà essere aggiunta in coda ai dati già presenti nel file testo.txtl
// e dò a questi dati una formattazione tipo
fs_stream.Write("var1=" + testo1 + "&var2=" + testo2 + ");
// chiudo l'oggetto TextStream object
fs_stream.close();
// Restituisco la variabile "att" settata sul valore "ok" in modo che il filmato flash SWF
// capisca che l'operazione è stata conclusa ed è andata a buon termine
Response.Write("att=ok");
} // end if (to_do == "add entry")
} // end if file exists
// se il file da aprire non esiste restituisco un messaggio d'errore
else {
Response.Write("att=error");
}
%>
da flash gli invii le var testo1 e testo2