<% tipo=request.QueryString("tipo") nome=Request.Form("nome") cognome=Request.Form("cognome") email1=Request.Form("email1") email2=Request.Form("email2") '***TASTO INSERIMENTO CONTROLLI 'CONTROLLO DATI errMSG="" okMSG="" IF cognome="" THEN errMSG="Cognome Obbligatorio"&"
" END IF IF email1="" THEN errMSG=errMSG+"Inserire l'indirizzo di posta elettronica"&"
" else if instr(email1,"@")<=0 then errMSG="L'indirizzo di posta elettronica è sbagliato ricontrollare!"&"
" else IF email2="" THEN errMSG="Inserire la conferma dell'indirizzo di posta elettronica"&"
" else if instr(email2,"@")<=0 then errMSG="L'indirizzo di conferma della posta elettronica è sbagliato ricontrollare!"&"
" else if email2<>email1 then errMSG="Inserimento sbagliato dell'indirizzo di posta ricontrollare!"&"
" end if end if END IF end if END IF if errMSG="" then 'TODO STESSA EMAIL cemail=DTLookup("id","contatti","dcancellazione=0 and email='"&email1&"' AND tipoprodotto='"+tipo+"' AND tipomedico=0") if isnull(cemail) or cemail&""="" then cemail=0 end if if cemail&""<>"0" then errMSG="Attenzione! Indirizzo di posta già presente nel nostro Database"&"
" end if end if nomepagina=tipo&"\home.asp?tppag="&tipo if errMSG="" then okMSG="Grazie. Benvenuti!" end if %>
<% '***INSERIMENTO O CANCELLAZIONE CON ERRORI RITORNO ERRORE if errMSG<>"" then %> <% else nome=REPLACE(nome,"'","''") cognome=REPLACE(cognome,"'","''") email1=REPLACE(email1,"'","''") idmail=DTLookup("id","contatti","email='"&email1&"' AND tipoprodotto='"+tipo+"' AND tipomedico=0") if isnull(idmail) or idmail&""="" then idmail=0 end if if idmail&""<>"0" then 'si è cancellato poi re-inserito TXT="UPDATE contatti SET dcancellazione=0" TXT=TXT&" ,nome='"&nome&"',cognome='"&cognome&"'" TXT=TXT&" ,email='"&email1&"',dinserimento="&DataINNumero(date)&"" TXT=TXT&" ,tipoprodotto='"+tipo+"',tipomedico=0" TXT=TXT&" WHERE="&idmail ESEGUOquery(TXT) else 'aggiungo TXT="INSERT INTO contatti (nome,cognome" TXT=TXT&" ,email,dinserimento" TXT=TXT&" ,tipoprodotto,tipomedico)" TXT=TXT&" VALUES " TXT=TXT&" ('"&nome&"','"&cognome&"'" TXT=TXT&" ,'"&email1&"',"&DataINNumero(date)&"" TXT=TXT&" ,'"+tipo+"',0)" ESEGUOquery(TXT) end if %> <% end if %>