Salve a tutti mi hanno "passato questa pagina" dove c'era un iserimento o un upgrade in database di due campi....tempo e commento
devo aggiungere l'inserimento o l'aggiornamento anche di un altro campo di tipo testo detto "titolo"........
siccome non ci capisco nulla potete aiutarmi?
grazie.........
questo è il codice:
<%@ LANGUAGE="JScript" %>
<% massima_lunghezza = 640 * 6 %>
<html>
<head>
<meta http-equiv="Content-Language" content="it">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Admin Diario</title>
<SCRIPT LANGUAGE="JavaScript" SRC="funzioni.js" TYPE="text/javascript" DEFER></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript" DEFER>
<!--
function cancella(c_tabella, c_id) {
if (window.confirm('Sicuro di voler cancellare il Record?'))
{ apri_pagina('admin_' + c_tabella + '.asp?cancella=1&ID=' + c_id) }
}
function modifica(m_tabella, m_id) {
apri_pagina('admin_' + m_tabella + '.asp?modifica=1&ID=' + m_id)
}
function controlla_inserisci() {
if (form_inserisci.commento.value == '')
{ window.alert('Specificare il Commento!')
return(false)
}
stringa = '<%= (Request.QueryString("modifica") == "1") ? "Modificare" : "Inserire" %>'
if (window.confirm(stringa + ' il Record nel Database?'))
{ return(true) }
return(false)
}
function controlla_lunghezza() {
l_massima = <%= massima_lunghezza %>
t_commento = form_inserisci.commento.value
cl_lunghezza = t_commento.length
l_reale = t_commento.length
cl_test = t_commento.match(new RegExp('&','gi'))
cl_lunghezza = (cl_test == null) ? cl_lunghezza : cl_lunghezza + (cl_test.length * 5)
cl_test = t_commento.match(new RegExp('<','gi'))
cl_lunghezza = (cl_test == null) ? cl_lunghezza : cl_lunghezza + (cl_test.length * 4)
cl_test = t_commento.match(new RegExp('>','gi'))
cl_lunghezza = (cl_test == null) ? cl_lunghezza : cl_lunghezza + (cl_test.length * 4)
cl_test = t_commento.match(new RegExp('\"','gi'))
cl_lunghezza = (cl_test == null) ? cl_lunghezza : cl_lunghezza + (cl_test.length * 6)
cl_test = t_commento.match(new RegExp('\'','gi'))
cl_lunghezza = (cl_test == null) ? cl_lunghezza : cl_lunghezza + (cl_test.length * 5)
form_inserisci.contatore.value = cl_lunghezza
form_inserisci.decontatore.value = l_massima - cl_lunghezza
if (cl_lunghezza > l_massima)
{ if (l_reale < l_massima)
{ taglio = l_reale - 2 }
else
{ taglio = l_massima - 2 }
form_inserisci.commento.value = t_commento.substr(0, taglio)
form_inserisci.contatore.value = l_massima - 2
form_inserisci.decontatore.value = 0
return(false)
}
return(true)
}
function conferma_invio_email() {
if (form_inserisci.invia_email.checked == 1)
{ return(window.confirm('Sicuro di voler inviare questo Record agli Iscritti alla Lista?')) }
}
// -->
</SCRIPT>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body>
<table cellpadding="0" cellspacing="0" width="660" height="598">
<tr>
<td height="93" align="center">
[img]../immagini/cubanissima_scritta.jpg[/img]
[img]../immagini/bandierafly.gif[/img]</td>
</tr>
<tr>
<td height="505" width="660" valign="top">
<FORM ACTION="admin_diario.asp" METHOD="post" NAME="form_inserisci" ID="form_inserisci" TARGET="_self">
<DIV ALIGN="right"></DIV>
<SPAN CLASS="titolopagina"><font size="3" face="Verdana, Arial, Helvetica, sans-serif">
<font color="#0000FF">Amministra Diario Personale</font></font></SPAN>
<%
db = Server.CreateObject("ADODB.Connection")
db.Open(sys_connessione)
if (Request.QueryString("cancella") == "1")
{ query = new Array()
query.push("DELETE")
query.push("FROM DIARIO")
query.push("WHERE ID=" + Request.QueryString("ID"))
query = query.join(" ")
db.Execute(query)
}
if (Request.Form("inserisci") == "1")
{ if (Request.Form("id_mod") == "0")
{ query = new Array()
query.push("INSERT")
query.push("INTO DIARIO")
query.push("(TEMPO, COMMENTO)")
query.push("VALUES")
query.push("(\'" + sys_tempo + "\',")
query.push("\'" + sys_no_html(Request.Form("commento")).substr(0, massima_lunghezza) + "\')")
query = query.join(" ")
db.Execute(query)
if (Request.Form("invia_email") == "1")
{ invia_email_diario(sys_no_html(Request.Form("comme nto")).substr(0, massima_lunghezza)) }
}
else
{ query = new Array()
query.push("UPDATE")
query.push("DIARIO")
query.push("SET")
query.push("COMMENTO=\'" + sys_no_html(Request.Form("commento")).substr(0, massima_lunghezza) + "\'")
query.push("WHERE ID=" + Request.Form("id_mod"))
query = query.join(" ")
db.Execute(query)
}
}
commento = ""
titolo = ""
id_mod = 0
etichetta = "Aggiungi"
rs = Server.CreateObject("ADODB.Recordset")
if (Request.QueryString("modifica") == "1")
{ query = new Array()
query.push("SELECT *")
query.push("FROM DIARIO")
query.push("WHERE ID=" + Request.QueryString("ID"))
query = query.join(" ")
rs.Open(query, db, adOpenStatic, adLockReadOnly)
if (!rs.EOF)
{ commento = rs.Fields("COMMENTO").value
titolo = rs.Fields("Titolo").value
id_mod = Request.QueryString("ID")
etichetta = "Salva Modifiche"
}
if (rs.State == adStateOpen) { rs.Close() }
}
%>
<TABLE BORDER="0">
<% if (etichetta == "Aggiungi") { %>
<% } %>
<TR>
<TD ALIGN="right" VALIGN="middle"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Commento</font></TD>
<TD><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="titolo" type="text" id="titolo" value="<%= titolo %>">
<INPUT TYPE="text" CLASS="numeri" NAME="contatore" ID="contatore" VALUE="<%= commento.length %>" SIZE="4" MAXLENGTH="4" READONLY>
/
<INPUT TYPE="text" CLASS="numeri" NAME="decontatore" ID="decontatore" VALUE="<%= massima_lunghezza - commento.length %>" SIZE="4" MAXLENGTH="4" READONLY>
(massimo <%= massima_lunghezza %> caratteri, alcuni valgono più di 1)
<TEXTAREA CLASS="obbligatorio" COLS="50" ROWS="5" NAME="commento" ID="commento" onChange="return(controlla_lunghezza())" onKeyPress="return(controlla_lunghezza())" onKeyDown="return(controlla_lunghezza())" onKeyUp="return(controlla_lunghezza())"><%= commento %></TEXTAREA>
</font></TD>
</TR>
<TR>
<TD COLSPAN="2" ALIGN="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<INPUT ONCLICK="return(controlla_inserisci())" TYPE="submit" NAME="f_submit" ID="f_submit" VALUE="<%= etichetta %>">
<% if (Request.QueryString("modifica") == "1") { %>
<INPUT ONCLICK="apri_pagina('admin_diario.asp')" TYPE="button" NAME="f_annulla" ID="f_annulla" VALUE="Annulla Modifica">
<% } %>
</font></TD>
</TR>
</TABLE>
<INPUT TYPE="hidden" NAME="id_mod" ID="id_mod" VALUE="<%= id_mod %>">
<INPUT TYPE="hidden" NAME="inserisci" ID="inserisci" VALUE="1">
<HR>
<%
query = new Array()
query.push("SELECT *")
query.push("FROM DIARIO")
query.push("ORDER BY TEMPO DESC")
query = query.join(" ")
rs.Open(query, db, adOpenStatic, adLockReadOnly)
while (!rs.EOF)
{ %>
<font color="#0000FF" size="3" face="Verdana, Arial, Helvetica, sans-serif">Amministrazione dei
diari</font>
<TABLE BORDER="0">
<TR>
<TD ALIGN="center" VALIGN="top">
<IMG onClick="modifica('diario', '<%= rs.Fields("ID").value %>')" SRC="admin_modifica.gif" ALT="Modifica Record #<%= rs.Fields("ID").value %>" WIDTH="16" HEIGHT="16" BORDER="2" CLASS="mano">
<IMG onClick="cancella('diario', '<%= rs.Fields("ID").value %>')" SRC="admin_cancella.gif" ALT="Cancella Commento #<%= rs.Fields("ID").value %>" WIDTH="16" HEIGHT="16" BORDER="2" CLASS="mano">
</TD>
<TD VALIGN="top">
<font size="3" face="Verdana, Arial, Helvetica, sans-serif"><%= String(rs.Fields("Titolo").value).replace(new RegExp("\r\n","gim"),"
") %></font>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif">Diario
del <%= sys_time2data(rs.Fields("TEMPO").value,"gMMMMaom") %></font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
</font>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%= String(rs.Fields("COMMENTO").value).replace(new RegExp("\r\n","gim"),"
") %> </font> </TD>
</TR>
</TABLE>
<font color="#0000FF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Amministrazione dei commenti
</font>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td>
<td width="280"><table width="280" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> ">[img]admin_modifica.gif[/img] <font size="2" face="Verdana, Arial, Helvetica, sans-serif">Modifica/Cancella
i commenti</font></td>
</tr>
</table></td>
</tr>
</table>
<HR>
<% rs.moveNext()
}
if (rs.State == adStateOpen) { rs.Close() }
rs = null
if (db.State == adStateOpen) { db.Close() }
db = null %>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
<% if (email_inviata == 1) { %>
window.alert('Messaggio invoato alla Mailing List!')
<% } %>
// -->
</SCRIPT>
</FORM>
</td>
</tr>
</table>
</body>
</html>

Rispondi quotando
