::: António Nunes ::: Armando Frazão :::
::: Bruno Espadana ::: João Coutinho ::: Marta Veríssimo :::
 

<% Flag = request.form("Flag") If IsEmpty(Flag) or Flag = "" then %>

Assinar o Livro de Visitas do Site Olhares.net

Nota: * Campos de preenchimento obrigatório!!

*Nome:
*Localidade:
 Distrito:
*País:
 Email:
 Homepage:
Comentário:
 
 
<% End If If Flag = 1 then If IsEmpty(request.form("Name")) or request.form("Name")="" then response.write "

" response.write "


Não introduziu Nome
" response.write "

" response.write "" response.write "
" response.end Else Name = request.form("Name") End If If IsEmpty(request.form("City")) or request.form("City")="" then response.write "
" response.write "


Não introduziu a Cidade
" response.write "

" response.write "" response.write "
" response.end Else City = request.form("City") End If ' we won't require a state State = request.form("State") If IsEmpty(request.form("Country")) or request.form("Country")="" then response.write "
" response.write "


Não Introduziu o País" response.write "

" response.write "" response.write "
" response.end Else Country = request.form("Country") End If Email = request.form("Email") If request.form("URL")="http://" then URL = "" Else URL = request.form("URL") End If If IsEmpty(request.form("Comments")) or request.form("Comments")="" or request.form("Comments")=" " then response.write "
" response.write "


Não introduziu o comentário" response.write "

" response.write "" response.write "
" response.end Else Comments = request.form("Comments") Comments = Replace(Comments, Chr(34), "''") Comments = Replace(Comments, vbCrLf, "
") End If Flag = request.form("Flag") %>

Aqui está o comentário que irá aparecer no nosso livro de visitas. Se pretender alterar alguma coisa carregue em alterar. Se estiver tudo bem, carregue em enviar!!!

Nome: <%= Name %>
Localidade: <%= City %>
Distrito: <%= State %>
Email: <%= Email %>
Homepage: <%= URL %>

Comentário: <%= Comments %>

 
<% End If If Flag = 2 then Today = Now() Name = request.form("Name") Name = Replace(Name, "'", "''") Name = Replace(Name, Chr(34), "''") City = request.form("City") City = Replace(City, "'", "''") State = request.form("State") Country = request.form("Country") Country = Replace(Country, "'", "''") Email = request.form("Email") URL = request.form("URL") Comments = request.form("Comments") Comments = Replace(Comments, "'", "''") ' ok now we've got our data so let's ship it off to the database set conn = server.createobject("adodb.connection") ' **** change DSN name if you're using a DSN and you've named it differently 'conn.open "guestbook" ' **** DSN-less connection: comment out above line and uncomment the ' **** Code between "Begin" and "End" ' **** BEGIN DSN-LESS CONNECTION CODE ' **** END OF DSN-LESS CONNECTION CODE ' **** Note: If using a DSN-less connection, make sure to change server.mappath above to ' **** reflect the actual location of the guestbook database file. ' **** The above will work if the database file is at the webserver root. ' **** See readme.txt for further information ' **** the following line would be used ONLY if you use a system DSN! ' conn.Open "guestbook" SQLstmt = "INSERT INTO Guestbook (Name,City,State,Country,Email,URL,Comments)" SQLstmt = SQLstmt & " VALUES (" SQLstmt = SQLstmt & "'" & Name & "'," SQLstmt = SQLstmt & "'" & City & "'," SQLstmt = SQLstmt & "'" & State & "'," SQLstmt = SQLstmt & "'" & Country & "'," SQLstmt = SQLstmt & "'" & Email & "'," SQLstmt = SQLstmt & "'" & URL & "'," SQLstmt = SQLstmt & "'" & Comments & "'" SQLstmt = SQLstmt & ")" Set RS = conn.execute(SQLstmt) If err.number>0 then response.write "VBScript Errors Occured:" & "

" response.write "Error Number=" & err.number & "

" response.write "Error Descr.=" & err.description & "

" response.write "Help Context=" & err.helpcontext & "

" response.write "Help Path=" & err.helppath & "

" response.write "Native Error=" & err.nativeerror & "

" response.write "Source=" & err.source & "

" response.write "SQLState=" & err.sqlstate & "

" end if IF conn.errors.count> 0 then response.write "Database Errors Occured" & "

" response.write SQLstmt & "

" for counter= 0 to conn.errors.count response.write "Error #" & conn.errors(counter).number & "

" response.write "Error desc. -> " & conn.errors(counter).description & "

" next else response.write "

" response.write "Obrigado! O seu comentário ficou registado!

" response.write "" response.write "Ver o Livro de Visitas" end if Conn.Close Set conn = nothing ' ***************************************************************** ' The following section of code sends email to the guestbook owner ' when somebody signs the guestbook. If you don't want this feature, ' just remove this block. Please note that this will ONLY work on ' NT SERVER with built-in SMTP!! If it fails, your host does not have ' this installed - comment this part out or check to see if they have ' a third-party email component available (and then reconfigure to use ' that component). ' ' I M P O R T A N T: ' Make sure to replace "your email address here" with YOUR email address! ' ****************************************************************** Set Mail = Server.CreateOBject( "JMail.Message" ) Mail.Logging = true Mail.silent = true ' get the sender's address, and if empty, put your own If request("email")="" then Sender = "email@joaocoutinho.net" ' put your email address here Else Sender = request("email") End If Mail.From = "email@joaocoutinho.net" Mail.FromName = Sender Mail.AddRecipient "email@joaocoutinho.net" ' put YOUR email address here Mail.Subject = "Livro de Visitas www.olhares.net" ' you can change this to whatever you'd like Msg = "Name: " & request("name") & Chr(10) Msg = Msg & "City: " & request("city") & Chr(10) Msg = Msg & "State: " & request("State") & Chr(10) Msg = Msg & "Country: " & request("Country") & Chr(10) Msg = Msg & "URL: " & URL & Chr(10) Msg = Msg & "Comments:" & Chr(10) Msg = Msg & request("Comments") Mail.Body = Msg If not Mail.Send("127.0.0.1") Then ola = 1 Else ola = 2 End If Set Mail = Nothing '********************************************************************* ' END OF EMAIL CODE '********************************************************************* End If %>