Ir para conteúdo
Fórum Script Brasil
  • 0

Script De Cadastro


ccgpirado

Pergunta

O que há de errado nesse script? lha as páginas:

cadastro.asp:

<html>

<head>

<title>Cadastrar</title>

<style type="text/css">

input {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 9px;

background-color: #CCCCCC;

}

textarea {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 9px;

background-color: #CCCCCC;

}

</style>

</head>

<body text="#FFFFFF" bgcolor="#003399" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">

<table border="0" width="100%">

  <tr>

    <td width="100%">

      <p align="center"><b><font size="4">Cadastro no ***Só Detonautas***</font></b></td>

  </tr>

</table>

      <form method="POST" action="envia_cadastro.asp">

      <div align="center">

        <table border="0" width="50%" cellspacing="0" cellpadding="0" height="185">

          <tr>

            <td width="32%" align="right" height="17">

              <p align="right"><font size="2">Titulo do Site:</font></p>

            </td>

        <center>

            <td width="68%" height="17"><input type="text" name="nome" size="20"></td>

          </tr>

                    <tr>

            <td width="32%" align="right" height="17">

              <p align="right"><font size="2">URL do site ou blog</font></p>

            </td>

        <center>

            <td width="68%" height="17"><input type="text" name="url" size="20"></td>

          </tr>

                    <tr>

            <td width="32%" align="right" height="17">

              <p align="right"><font size="2">MSN OU ICQ:</font></p>

            </td>

        <center>

            <td width="68%" height="17"><input type="text" name="msnicq" size="20"></td>

          </tr>

                    <tr>

            <td width="32%" align="right" height="17">

              <p align="right"><font size="2">Sua idade:</font></p>

            </td>

        <center>

            <td width="68%" height="17"><input type="text" name="idade" size="20"></td>

          </tr>

                    <tr>

            <td width="32%" align="right" height="17">

              <p align="right"><font size="2">Seu nome de usuário:</font></p>

            </td>

        <center>

            <td width="68%" height="17"><input type="text" name="usuario" size="20"></td>

          </tr>

                    <tr>

            <td width="32%" align="right" height="17">

              <p align="right"><font size="2">Sua senha:</font></p>

            </td>

        <center>

            <td width="68%" height="17"><input type="text" name="senha" size="20"></td>

          </tr>

                    <tr>

            <td width="32%" align="right" height="17">

              <p align="right"><font size="2">Seu e-mail</font></p>

            </td>

        <center>

            <td width="68%" height="17"><input type="text" name="email" size="20"></td>

          </tr>

                    <tr>

            <td width="32%" align="right" height="17">

              <p align="right"><font size="2">Cidade, estado e país:</font></p>

            </td>

        <center>

            <td width="68%" height="17"><input type="text" name="cep" size="20"></td>

          </tr>

          <tr>

            <td width="32%" align="right" height="20"></td>

            <td width="68%" height="20"><input type="submit" value="Enviar"></td>

          </tr>

        </table>

        </center>

      </div>

      &nbsp;</form>

</body>

</html>

envia_cadastro.asp

<html>

<head>

<title>Cadastrado</title>

<style type="text/css">

input {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 9px;

background-color: #CCCCCC;

}

textarea {

font-family: Verdana, Arial, Helvetica, sans-serif;

font-size: 9px;

background-color: #CCCCCC;

}

</style>

</head>

<body text="#FFFFFF" bgcolor="#003399" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">

<!--#include file="config.asp" -->

<%

' Recebe e guarda os valores do formulário de cadastro

nome = request("nome")

url = request("url")

email = request("email")

msnicq = request("msnicq")

idade = request("idade")

usuario = request("usuario")

senha = request("senha")

cep = request("cep")

' Verifica se algum dos campos está vazio

if titulo = "" OR nome = "" OR url = "" OR email = "" OR msnicq = "" OR idade = "" OR uduario = "" OR senha = "" OR cep = "" then

response.write "<font face=verdana size=2>Você deixou algum dos campos em branco! <br><br><a href=""javascript:history.go(-1)"">Voltar</a></font>"

response.end

end if

' Se nenhum dos campos está vazio, efetua o cadastro no banco de dados

strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath(db)

Set conn = Server.CreateObject("ADODB.Connection")

conn.open strCon

sql = "INSERT INTO dados (nome, url, email, msnicq, idade, usuario, senha, cep) VALUES('"& nome &"', '"& url &"', '"& email &"', '"& msnicq &"', '"& idade &"', '"& usuario &"', '"& senha &"', '"& cep &"')"

Set rs = Server.CreateObject("ADODB.Recordset")

rs.CursorType = 3

rs.CursorLocation = 3

rs.LockType = 3

rs.Open sql, conn

if not rs2.eof then

%>

<a href=""javascript:history.go(-1)"">Voltar</a>

<%

else

response.write "Erro!"

end if

end if

Set rs = nothing

Set rs2 = nothing

%>

</body>

</html>

e config.asp

<% '-------------Produção indepedente-----------------

user = "*********" 'user administrativo

senha = "******" 'senha administrativa

db = "links" 'caminho pro db sem .mdb

%>

Obrigado desde já....

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

Qual o erro? E você não precisa criar um Recordset para executar uma instrução SQL. Bastaria fazer:

conn.open strCon
sql = "INSERT INTO dados (nome, url, email, msnicq, idade, usuario, senha, cep) VALUES('"& nome &"', '"& url &"', '"& email &"', '"& msnicq &"', '"& idade &"', '"& usuario &"', '"& senha &"', '"& cep &"')"
conn.Execute sql

Isso ao invés de criar "rs". Além disso, de onde veio "rs2"?

Abraços,

Graymalkin

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...