Ir para conteúdo
Fórum Script Brasil

fabio mazzi

Membros
  • Total de itens

    14
  • Registro em

  • Última visita

Sobre fabio mazzi

Contatos

  • MSN
    fabiomazzi@msn.com

Perfil

  • Gender
    Male

fabio mazzi's Achievements

0

Reputação

  1. Pessoal é o seguinte estou utilizando a rotina abaixo descriminada junto com o meu banco de dados para criptografar as senhas dos usuarios já existentes. TABELA USUARIOS e O SCRIPT segue abaixo: <% '======================================================= 'CLASSE DE CRIPTOGRAFIA DE STRINGS '======================================================= Class Criptografia '----------------------------------------------------- 'Atributos/Constantes da Classe '----------------------------------------------------- Private dblCenterY Private dblCenterX Private LastResult Private LastErrDes Private LastErrNum Private errInvalidKeyLength Private errInvalidKey Private errInvalidSize Private errKeyMissing Private errClearTextMissing Private errCipherTextMissing Private A Private B Private C Private D Private E Private F '----------------------------------------------------- 'Procedimentos de Inicialização de Destruição da Classe '----------------------------------------------------- Private Sub Class_Initialize() 'Inivializando as variáveis errInvalidKeyLength = 65101 errInvalidKey = 65102 errInvalidSize = 65103 errKeyMissing = 65303 errClearTextMissing = 65304 errCipherTextMissing = 65305 A = 10 B = 11 C = 12 D = 13 E = 14 F = 15 End Sub Private Sub Class_Terminate() End Sub Function QuickEncrypt(strClear, strKey) Dim intRet intRet = EncryptText(strClear, strKey) If intRet = -1 Then QuickEncrypt = "ERROR" Else QuickEncrypt = LastResult End If End Function Function QuickDecrypt(strCipher, strKey) Dim intRet intRet = DecryptText(strCipher, strKey) If intRet = -1 Then QuickDecrypt = "ERROR" Else QuickDecrypt = LastResult End If End Function Function GetStrength(strPassword) strPassword = CStr(strPassword) GetStrength = (Len(strPassword) * 8) + (Len(GetSerial) * 8) End Function Function GetSerial() GetSerial = Now End Function Function GetHash(strKey) Dim strCipher Dim byKey() ReDim byKey(Len(strKey)) For i = 1 To Len(strKey) byKey(i) = Asc(Mid(strKey, i, 1)) Next For i = 1 To UBound(byKey) / 2 strCipher = strCipher & NumToHex(byKey(i) Xor byKey((UBound(byKey) - i) + 1)) Next GetHash = strCipher End Function Function CreatePassword(strSeed, lngLength) Dim bySeed() Dim bySerial() Dim strTimeSerial Dim Random Dim lngPosition Dim lngSerialPosition strCipher = "" lngPosition = 1 lngSerialPosition = 1 ReDim bySeed(Len(strSeed)) For i = 1 To Len(strSeed) bySeed(i) = Asc(Mid(strSeed, i, 1)) Next strTimeSerial = GetSerial() ReDim bySerial(Len(strTimeSerial)) For i = 1 To Len(strTimeSerial) bySerial(i) = Asc(Mid(strTimeSerial, i, 1)) Next ReCenter CDbl(bySeed(lngPosition)), CDbl(bySerial(lngSerialPosition)) lngPosition = lngPosition + 1 lngSerialPosition = lngSerialPosition + 1 For i = 1 To (lngLength / 2) Generate CDbl(bySeed(lngPosition)), CDbl(bySerial(lngSerialPosition)), False strCipher = strCipher & NumToHex(MakeRandom(dblCenterX, 255)) strCipher = strCipher & NumToHex(MakeRandom(dblCenterY, 255)) If lngPosition = Len(strSeed) Then lngPosition = 1 Else lngPosition = lngPosition + 1 End If If lngSerialPosition = Len(strTimeSerial) Then lngSerialPosition = 1 Else lngSerialPosition = lngSerialPosition + 1 End If Next CreatePassword = Left(strCipher, lngLength) End Function Sub ReCenter(mdblCenterY, mdblCenterX) dblCenterY = mdblCenterY dblCenterX = mdblCenterX End Sub Sub Generate(dblRadius, dblTheta, blnRad) Const Pi = 3.14159265358979 Const sngMaxUpper = 2147483647 Const sngMaxLower = -2147483648 If blnRad = False Then If (dblRadius * Cos((dblTheta / 180) * Pi)) + dblCenterX > sngMaxUpper Or (dblRadius * Cos((dblTheta / 180) * Pi)) + dblCenterX < sngMaxLower Then ReCenter dblCenterY, 0 Else dblCenterX = (dblRadius * Cos((dblTheta / 180) * Pi)) + dblCenterX End If If (dblRadius * Sin((dblTheta / 180) * Pi)) + dblCenterY > sngMaxUpper Or (dblRadius * Sin((dblTheta / 180) * Pi)) + dblCenterY < sngMaxLower Then ReCenter 0, dblCenterX Else dblCenterY = (dblRadius * Sin((dblTheta / 180) * Pi)) + dblCenterY End If Else If (dblRadius * Cos(dblTheta)) + dblCenterX > sngMaxUpper Or (dblRadius * Cos(dblTheta)) + dblCenterX < sngMaxLower Then ReCenter dblCenterY, 0 Else dblCenterX = (dblRadius * Cos(dblTheta)) + dblCenterX End If If (dblRadius * Sin(dblTheta)) + dblCenterY > sngMaxUpper Or (dblRadius * Sin(dblTheta)) + dblCenterY < sngMaxLower Then ReCenter 0, dblCenterX Else dblCenterY = (dblRadius * Sin(dblTheta)) + dblCenterY End If End If End Sub Function MakeRandom(dblValue, lngMax) Dim lngRandom lngRandom = Int(dblValue Mod (lngMax + 1)) If lngRandom > lngMax Then lngRandom = 0 End If MakeRandom = Abs(lngRandom) End Function Sub RaiseError(lngErrNum, strErrDes) LastErrDes = strErrDes LastErrNum = lngErrNum End Sub Function EncryptText(strClear, strKey) Dim byClear() Dim byKey() Dim byCipher() Dim lngPosition Dim lngSerialPosition Dim strTimeSerial Dim blnSecondValue Dim strCipher Dim i strKey = CStr(strKey) strClear = CStr(strClear) If strKey = "" Then RaiseError errKeyMissing, "Key Missing" EncryptText = -1 Exit Function End If If Len(strKey) <= 1 Then RaiseError errInvalidKeyLength, "Invalid Key Length" EncryptText = -1 Exit Function End If strTimeSerial = GetSerial() ReDim byKey(Len(strKey)) For i = 1 To Len(strKey) byKey(i) = Asc(Mid(strKey, i, 1)) Next If Len(strClear) = 0 Then RaiseError errInvalidSize, "Text Has Zero Length" EncryptText = -1 Exit Function End If ReDim byClear(Len(strClear)) For i = 1 To Len(strClear) byClear(i) = Asc(Mid(strClear, i, 1)) Next lngPosition = 1 lngSerialPosition = 1 For i = 1 To UBound(byKey) / 2 strCipher = strCipher & NumToHex(byKey(i) Xor byKey((UBound(byKey) - i) + 1)) Next lngPosition = 1 strCipher = strCipher & NumToHex(Len(strTimeSerial) Xor byKey(lngPosition)) lngPosition = lngPosition + 1 For i = 1 To Len(strTimeSerial) strCipher = strCipher & NumToHex(byKey(lngPosition) Xor Asc(Mid(strTimeSerial, i, 1))) If lngPosition = UBound(byKey) Then lngPosition = 1 Else lngPosition = lngPosition + 1 End If Next lngPosition = 1 lngSerialPosition = 1 ReCenter CDbl(byKey(lngPosition)), Asc(Mid(strTimeSerial, lngSerialPosition, 1)) lngPosition = lngPosition + 1 lngSerialPosition = lngSerialPosition + 1 blnSecondValue = False For i = 1 To UBound(byClear) If blnSecondValue = False Then Generate CDbl(byKey(lngPosition)), Asc(Mid(strTimeSerial, lngSerialPosition, 1)), False strCipher = strCipher & NumToHex(byClear(i) Xor MakeRandom(dblCenterX, 255)) blnSecondValue = True Else strCipher = strCipher & NumToHex(byClear(i) Xor MakeRandom(dblCenterY, 255)) blnSecondValue = False End If If lngPosition = UBound(byKey) Then lngPosition = 1 Else lngPosition = lngPosition + 1 End If If lngSerialPosition = Len(strTimeSerial) Then lngSerialPosition = 1 Else lngSerialPosition = lngSerialPosition + 1 End If Next LastResult = strCipher EncryptText = 1 Exit Function End Function Public Function DecryptText(strCipher, strKey) Dim strClear Dim byCipher() Dim byKey() Dim strTimeSerial Dim strCheckKey Dim lngPosition Dim lngSerialPosition Dim lngCipherPosition Dim bySerialLength Dim blnSecondValue Dim i strCipher = CStr(strCipher) strKey = CStr(strKey) If Len(strCipher) = 0 Then RaiseError errCipherTextMissing, "Cipher Text Missing" DecryptText = -1 Exit Function End If If Len(strCipher) < 10 Then RaiseError errInvalidSize, "Bad Text Length" DecryptText = -1 Exit Function End If If Len(strKey) = 0 Then RaiseError errKeyMissing, "Key Missing" DecryptText = -1 Exit Function End If If Len(strKey) <= 1 Then RaiseError errInvalidKeyLength, "Invalid Key Length" DecryptText = -1 Exit Function End If ReDim byKey(Len(strKey)) For i = 1 To Len(strKey) byKey(i) = Asc(Mid(strKey, i, 1)) Next ReDim byCipher(Len(strCipher) / 2) lngCipherPosition = 1 For i = 1 To Len(strCipher) Step 2 byCipher(lngCipherPosition) = HexToNum(Mid(strCipher, i, 2)) lngCipherPosition = lngCipherPosition + 1 Next lngCipherPosition = 1 For i = 1 To UBound(byKey) / 2 strCheckKey = strCheckKey & NumToHex(byKey(i) Xor byKey((UBound(byKey) - i) + 1)) Next If Left(strCipher, Len(strCheckKey)) <> strCheckKey Then RaiseError errInvalidKey, "Invalid Key" DecryptText = -1 Exit Function Else lngCipherPosition = (Len(strCheckKey) / 2) + 1 End If lngPosition = 1 bySerialLength = byCipher(lngCipherPosition) Xor byKey(lngPosition) lngCipherPosition = lngCipherPosition + 1 lngPosition = lngPosition + 1 For i = 1 To bySerialLength strTimeSerial = strTimeSerial & Chr(byCipher(lngCipherPosition) Xor byKey(lngPosition)) If lngPosition = UBound(byKey) Then lngPosition = 1 Else lngPosition = lngPosition + 1 End If lngCipherPosition = lngCipherPosition + 1 Next lngPosition = 1 lngSerialPosition = 1 ReCenter CDbl(byKey(lngPosition)), Asc(Mid(strTimeSerial, lngSerialPosition, 1)) lngPosition = lngPosition + 1 lngSerialPosition = lngSerialPosition + 1 blnSecondValue = False For i = 1 To UBound(byCipher) - lngCipherPosition + 1 If blnSecondValue = False Then Generate CDbl(byKey(lngPosition)), Asc(Mid(strTimeSerial, lngSerialPosition, 1)), False strClear = strClear & Chr(byCipher(lngCipherPosition) Xor MakeRandom(dblCenterX, 255)) blnSecondValue = True Else strClear = strClear & Chr(byCipher(lngCipherPosition) Xor MakeRandom(dblCenterY, 255)) blnSecondValue = False End If If lngPosition = UBound(byKey) Then lngPosition = 1 Else lngPosition = lngPosition + 1 End If If lngSerialPosition = Len(strTimeSerial) Then lngSerialPosition = 1 Else lngSerialPosition = lngSerialPosition + 1 End If lngCipherPosition = lngCipherPosition + 1 Next LastResult = strClear DecryptText = 1 Exit Function End Function Function NumToHex(bByte) Dim strOne Dim strTwo strOne = CStr(Int((bByte / 16))) strTwo = bByte - (16 * strOne) If CDbl(strOne) > 9 Then If CDbl(strOne) = 10 Then strOne = "A" ElseIf CDbl(strOne) = 11 Then strOne = "B" ElseIf CDbl(strOne) = 12 Then strOne = "C" ElseIf CDbl(strOne) = 13 Then strOne = "D" ElseIf CDbl(strOne) = 14 Then strOne = "E" ElseIf CDbl(strOne) = 15 Then strOne = "F" End If End If If CDbl(strTwo) > 9 Then If strTwo = "10" Then strTwo = "A" ElseIf strTwo = "11" Then strTwo = "B" ElseIf strTwo = "12" Then strTwo = "C" ElseIf strTwo = "13" Then strTwo = "D" ElseIf strTwo = "14" Then strTwo = "E" ElseIf strTwo = "15" Then strTwo = "F" End If End If NumToHex = Right(strOne & strTwo, 2) End Function Function HexToNum(hexnum) Dim X Dim y Dim cur hexnum = UCase(hexnum) cur = CStr(Right(hexnum, 1)) Select Case cur Case "A" y = A Case "B" y = B Case "C" y = C Case "D" y = D Case "E" y = E Case "F" y = F Case Else y = CDbl(cur) End Select Select Case Left(hexnum, 1) Case "0" X = (16 * CInt(Left(hexnum, 1))) + y Case "1" X = (16 * CInt(Left(hexnum, 1))) + y Case "2" X = (16 * CInt(Left(hexnum, 1))) + y Case "3" X = (16 * CInt(Left(hexnum, 1))) + y Case "4" X = (16 * CInt(Left(hexnum, 1))) + y Case "5" X = (16 * CInt(Left(hexnum, 1))) + y Case "6" X = (16 * CInt(Left(hexnum, 1))) + y Case "7" X = (16 * CInt(Left(hexnum, 1))) + y Case "8" X = (16 * CInt(Left(hexnum, 1))) + y Case "9" X = (16 * CInt(Left(hexnum, 1))) + y Case "A" X = 160 + y Case "B" X = 176 + y Case "C" X = 192 + y Case "D" X = 208 + y Case "E" X = 224 + y Case "F" X = 240 + y End Select HexToNum = X End Function End Class%> <!--#include file="configuracoes/conexao.asp"--> <% 'session("banco")="intranet" call abre_conexao() sql = "select * from cadastro_usuarios" Set rs_login = Server.CreateObject("ADODB.Recordset") rs_login.CursorLocation = 3 rs_login.Open SQL, conexao '--------------------------------------------------------------------------------------------- Dim objCriptografia while not rs_login.eof Set objCriptografia = New Criptografia Response.Write "<br />Usuario: " & rs_login("usuario") Response.Write "<br />Senha: " & rs_login("senha") vC = objCriptografia.QuickEncrypt("'"&rs_login("senha")&"'", "%r3E9gY,gq4$2#*") Response.Write "<br />Senha Cript: " & vC vD = objCriptografia.QuickDecrypt(objCriptografia.QuickEncrypt(vD, "%r3E9gY,gq4$2#*"), "%r3E9gY,gq4$2#*") Response.Write "<br />Senha Decript: " & vD Response.Write "<br />Encriptacaoo: " & objCriptografia.QuickEncrypt("123456", "%r3E9gY,gq4$2#*") Response.Write "<br />Decriptacao: " & objCriptografia.QuickDecrypt(objCriptografia.QuickEncrypt("123456", "%r3E9gY,gq4$2#*"), "%r3E9gY,gq4$2#*") Response.Write "<br />-----------------------------------------------------------------------" Set objCriptografia = Nothing rs_login.movenext wend response.End() '--------------------------------------------------------------------------------------------- %> Quando executo o arquivo criptografar.asp traz o seguinte resultado: Minha duvida é a seguinte: Quando pego a senha do banco de dados ele criptografa, porém ao decriptografar ele retorna ERROR, porem nos valores que são fixo pra senha ele criptografa e decriptografa normalmente. Alguém poderia me ajudar para ver o que pode estar errado? Grato, Fabio Mazzi
  2. fabio mazzi

    impressão no asp

    Pessoal é o seguinte: Aqui onde trabalho as pessoas fazem relatorio no word e imprime o conteudo no papel timbrado. porem cada relatorio é somente uma pagina. Então eles estão enjoados de ter que colocar folhas timbradas na impressora então abrir cada arquivo do word e imprimir um por um e normalmente por dia é em torno de 20 a 30 relatorios emitidos com isso perdesse muito tempo. então meu chefe pediu para que eu criasse um sistema onde entrariam com essas informações no sistema e as informações iriam para o banco de dados. quando quisessem imprimir abririam o sistema e informariam de qual a qual relatorio querem imprimir por exemplo do relatorio 1220 a 1325. Já tenho a base e o sistema cadastrando porém não sei como fazer para sair esse impressao. se alguém puder ajudar ficarei grato,
  3. eu fiz assim: sql = "SELECT * FROM teste" set teste = conexao.execute(sql) teste.LockType = 4 e ele deu o seguinte erro: ADODB.Recordset error '800a0e79' Operation is not allowed when the object is open. /maisenvio/home/_teste.asp, line 15 que a linha quinze é justamente: teste.LockType = 4 alguém tem mais alguma sugestao????
  4. Pessoal é o seguinte, eu tenho o uma pagina com o seguinte codigo: <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <!--#include file="../Connections/conexao.asp" --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>teste</title> </head> <body> <% call abre_conexao Dim teste Dim teste_numRows Set teste = Server.CreateObject("ADODB.Recordset") teste.ActiveConnection = conexao teste.Source = "SELECT * FROM teste" teste.CursorType = 0 teste.CursorLocation = 2 teste.LockType = 3 teste.Open() teste_numRows = 0 while not teste.eof response.write "nome: "&teste("nome")&"<br>" teste.movenext wend teste.AddNew teste("nome")="teste" teste.Update teste.movefirst response.write "<p>novo<br>" while not teste.eof response.write "nome: "&teste("nome")&"<br>" teste.movenext wend teste.close Set teste = nothing call fecha_conexao %> </body> </html> neste codigo eu lista a tabela teste do meu banco de dados que tem um campo nome, e logo em seguida eu adiciono mais um nome e peço para listar novamente, ate ai tudo bem, porem se eu trocar as seguintes linhas: Dim teste Dim teste_numRows Set teste = Server.CreateObject("ADODB.Recordset") teste.ActiveConnection = conexao teste.Source = "SELECT * FROM teste" teste.CursorType = 0 teste.CursorLocation = 2 teste.LockType = 3 teste.Open() teste_numRows = 0 pelas linhas: sql = "SELECT * FROM teste" set teste = conexao.execute(sql) eu consigo listar os registros, porém ao tentar adicionar um novo registro me exibe a mensagem: ADODB.Recordset error '800a0cb3' Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype. /maisenvio/home/_teste.asp, line 32 sendo a linha 32 o comando: teste.AddNew alguém poderia me ajudar???? o arquivo conexao.asp tem o seguinte conteudo: <% session("path_banco") = "e:\sites\teste\dados\bd_teste.mdb" dim conexao sub abre_conexao set conexao = CreateObject("ADODB.Connection") Conexao.Open "DBQ="&session("path_banco")&";Driver={Microsoft Access Driver (*.mdb)}" end sub '---------------------------------------------------------------------------------------------------------------------------- sub fecha_conexao Conexao.close Set Conexao = nothing end sub %>
  5. Pessoal é o seguinte, estive procurando aqui e não encontrei, eu tenho um site que é tem area de noticias onde esta tem uma busca nos campos titulo ou noticia, eu consegui fazer com que ele procure nos dois campos, por exemplo se digitar alguma palavra que esteja no campo titulo ou no campo noticia ele localiza, porem se eu digitar duas palavras por exemplo artigo e a palavra unico "artigo unico" e a palavra artigo e unico não estiverem no mesmo campo ele não localiza pra mim, como eu posso fazer isso? seguem abaixo o meu codigo. <% If (Request.QueryString("busca") <> "") Then vPalavras = Request.QueryString("busca") else vPalavras = trim(Request.QueryString("busca")) End If %> <% Dim rs_pesquisa Dim rs_pesquisa_numRows Set rs_pesquisa = Server.CreateObject("ADODB.Recordset") rs_pesquisa.ActiveConnection = MM_conexao_STRING rs_pesquisa.Source = "SELECT * FROM noticias WHERE noticia LIKE '%" + Replace(vPalavras, "'", "''") + "%' OR apresentacao LIKE '%" + Replace(vPalavras, "'", "''") + "%'" rs_pesquisa.CursorType = 0 rs_pesquisa.CursorLocation = 3 rs_pesquisa.LockType = 1 rs_pesquisa.Open() rs_pesquisa_numRows = 0 %> <% while not rs_pesquisa.eof response.write rs_pesquisa("apresentacao") rs_pesquisa.movenext wend rs_pesquisa.Close() Set rs_pesquisa = Nothing %>
  6. fabio mazzi

    php + xml

    Bom Dia pessoal, esta semana foi corrido, não deu tempo de responder ao tópico, fico grato pela ajuda de todos, antes de comecarem a responder, consegui encontrar uma solucao. foi assim que resolvi: <? php $arquivo = "../xml/contar.txt"; if (file_exists($arquivo)) { $fd = fopen($arquivo, "r"); $valor_atual = chop(fgets($fd)); fclose($fd); $valor_atual++; } else $valor_atual = 1; $ponteiro = fopen ($arquivo, "w"); fwrite($ponteiro, $valor_atual); fclose($ponteiro); $nome = $_POST['nome']; $empresa = $_POST['empresa']; $email = $_POST['email']; $ddi = $_POST['ddi']; $ddd = $_POST['ddd']; $tel = $_POST['tel']; $fax = $_POST['fax']; $telefone = "(".$ddi." ".$ddd.") ".$tel; $endereco = $_POST['endereco']; $bairro = $_POST['bairro']; $cep = $_POST['cep']; $cidade = $_POST['cidade']; $estado = $_POST['estado']; $mensagem = str_replace(chr(13),"<br>", $_POST['mensagem']); $retorno = $_POST['retorno']; $emailpara = $_POST['departamento']; $arquivo = fopen("../xml/".$valor_atual.".xml", "w"); $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <informacoes> <cadastro> <nomePessoa>".$nome."</nomePessoa> <emailPessoa>".$email."</emailPessoa> </cadastro> </informacoes>"; fputs($arquivo, $xml); fclose($arquivo); ?>
  7. fabio mazzi

    php + xml

    Pessoal, sou novato na programacao em php e nunca trabalhei com xml, meu problema é o seguinte, eu preciso criar um arquivo xml a partir de um formulario. A parte de gerar o xml eu consegui fazer, porem não consigo criar o arquivo fisicamente no servidor. alguém poderia me ajudar??? segue o codigo: <?php $xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> <informacoes>"; $xml .="<cadastro> <nomePessoa>'".$nome."'</nomePessoa> <emailPessoa>'".$email."'</emailPessoa> </cadastros>"; $xml .="</informacoes>"; echo $xml; ?>
  8. fabio mazzi

    Data errada

    Pessoal é o seguinte eu tenho o codigo abaixo: if Request.Form("hddAction") = "altnoticia" then if request.form("chkAltVisualizacao") = "False" then vData = "1/1/1900" vHome = "False" else vData = Request.Form("dataexp") vHome = "True" end if Set varAction = Server.CreateObject("ADODB.Command") varAction.ActiveConnection = MM_conexao_STRING varSql = "UPDATE tbNoticias SET titNot='"&Request.Form("titulo")&"', textoNot='"&Request.Form("texto")&"', area="&Request.Form("area")&", dataexpiracao=#"&vData&"#,home="&vHome&" WHERE codNot="&request.form("codigo") varAction.CommandText = varSql varAction.Execute response.redirect("../gestor/alterar.asp?codigo="&request.form("codigo")&"&acao=anot&msg=Unidade alterada com sucesso&tipo=alterar") end if o problema que ocorre é o seguinte: quando ele grava na base de dados (access) e a data for 10/05/2008 na base ele grava 05/10/2008, se executo o comando de novo ele grava 10/05/2008 ou seja ele sempre inverte mes e dia, como fazer pra ele não inverter? e gravar a data normal? detalhe se eu der um response.write vData ele me traz a data correta, ou seja o que esta em Request.Form("dataexp")? o que pode estar aacontencendo? grato.
  9. Pessoal, tenho este script abaixo que faz o seguinte: pega a data de hj e joga na variavel varHoje dps ele marca o campo Home como falso mas somente os que a dataexpiracao for menor que a data de hoje e por fim executa o comando. tentei fazer isso trocando a data de expiracao por codigo da noticia < 30 por exemplo e funcionou, so que quando coloco a data ele não altera registro nenhum e eu tenho registro com data menor do que a de hoje por exemplo. o campo dataexpiracao é do tipo data/hora. tentei usar este comando no access onde esta o banco e ele tambem não funcionou UPDATE tbNoticias SET home=False WHERE dataexpiracao < 27/6/2007 este abaixo funcionou no access UPDATE tbNoticias SET home=False WHERE codNoticia < 30 se trocar varHoje e colocar o varCodigo e varCodigo for = a 30 por exemplo funciona. UPDATE tbNoticias SET home=False WHERE codNoticia < "&varCodigo não FUNCIONA <% varHoje = date() Set varAction = Server.CreateObject("ADODB.Command") varAction.ActiveConnection = MM_conexao_STRING varSql = "UPDATE tbNoticias SET home=False WHERE dataexpiracao < "&varHoje varAction.CommandText = varSql varAction.Execute Set varAction = Nothing %> FUNCIONA varCodigo = 30 Set varAction = Server.CreateObject("ADODB.Command") varAction.ActiveConnection = MM_conexao_STRING varSql = "UPDATE tbNoticias SET home=False WHERE codNotica < "&varCodigo varAction.CommandText = varSql varAction.Execute Set varAction = Nothing %> ele não da erro nenhum, e no access, ele me exibe a mensagem pra confirmar a exclusao dos registros, porem indica que 0 linhas serao alteradas. alguém pode me ajuda.
  10. basta colocar assim: Set FSO = Server.CreateObject("Scripting.FileSystemObject") Set FSO.CreateFolder("c:\NovaPasta") pois também usava do outro jeito e não funcionou, ai fiz dessa maneira e funcionou :) :lol:
  11. é assim, eu tenho uma pagina onde eu faço pedidos, qtde, produto, quem atendeu. então no menu tem uma opçao para ver os pedidos dos clientes, e cada cliente tem uma linha onde tem la excluir, alterar, deletar, alem da somatoria total da qtde de produtos que tem pra ele por exemplo se ele compro 10 balas e 5 chicletes, aparece nesse campo o valor 15, quando eu clico no alterar, ele me abre uma janela, onde eu posso alterar a qtde de material solicidado, cada linha é para um produto, então la teria uma linha mostrando 5 chicletes e 10 balas, então posso alterar a qtde de chicletes por exemplo pra 10 também, ate aí tudo bem, porem quando eu fecho a janela de alteração, eu keria que akela tela anterior, já alterasse o valor total da qtde ou seja de 15 já mostrasse 20, mas não to conseguindo, ele so funciona quando do um refresh no navegador ou F5
  12. o que ela pode fazer seria ao invés de usar um pop-up, seria montar uma pagina normal (em Deawnweaver por exemplo), deixa um tamanho fixo e esconder todas as barras, aí o anti pop-up não o bloqueará..... me corrijam se estiver falando besteira.... pois so novato ainda em programação WEB... abraços.....
  13. Ola pessoal sou novo aqui e estou com a seguinte duvida, eu tenho uma pagina, que uma das opcoes, e que mostra o conteudo de uma base, chama uma outra pagina , e uma dessas paginas nela eu posso alterar o valor da quantidade, e eu gostaria de saber como fazer, para ao fechar essa janela que eu altero o valor, a janela que mostra os valores seja atualizada automaticamente.
  14. Pessoal é o seguinte, eu to entrando agora no mundo ASP e já to com pepinao pra resolver meu problema é bem parecido com o citado neste tópico: https://www.scriptbrasil.com.br/forum/index...=17&t=67790, porem as instrucoes if esta dentro do item value, e o que preciso é o seguinte, se a pessoa escolher um dos clientes ele vai puxar os dados, ou ele pode digita, eu gostaria se a pessoa escolher um cliente, eu gostaria que já travasse o campo. Ai esta um exemplo do codigo: <td width="78%"> <input name="nomeempresa" type="text" class="form" id="nomeempresa" value="<%if Request.QueryString("repre") <> "" then Set rs_repreid = Server.CreateObject("ADODB.Recordset") rs_repreid.ActiveConnection = conn rs_repreid.Source = "SELECT * FROM etiqueta WHERE id=" & Request.QueryString("repre") rs_repreid.CursorType = 0 rs_repreid.CursorLocation = 2 rs_repreid.LockType = 1 rs_repreid.Open() Response.Write rs_repreid("nomeempresa") else Response.Write Request.Querystring("nomeempresa") end if %>" size="50" maxlength="45"></td> então se repre for diferente de vazio ele seleciona no banco os itens necessarios retorna o nome da empresa, senao ele deixa do jeito que esta, como fazer pra k o codigo caso eu selecione um cliente trave o campo para não ser editado????
×
×
  • Criar Novo...