Ir para conteúdo
Fórum Script Brasil

Alyson Ronnan Martins

Membros
  • Total de itens

    847
  • Registro em

  • Última visita

Tudo que Alyson Ronnan Martins postou

  1. Novamente confuso kkkk tem skype ou telegram para tentar me explicar melhor?
  2. Alyson Ronnan Martins

    Login incorreto

    Eu fiz a conexão via OO e ficou assim: <?php session_start(); // initializing variables $user_name = ""; $user_email = ""; $errors = array(); // connect to the database $db_sys = new mysqli('localhost', 'root', '', 'test'); // REGISTER USER if (isset($_POST['user_reg'])) { // receive all input values from the form $user_name = mysqli_real_escape_string($db_sys, $_POST['user_name']); $user_email = mysqli_real_escape_string($db_sys, $_POST['user_email']); $user_pass1 = mysqli_real_escape_string($db_sys, $_POST['user_pass1']); $user_pass2 = mysqli_real_escape_string($db_sys, $_POST['user_pass2']); // form validation: ensure that the form is correctly filled ... // by adding (array_push()) corresponding error unto $errors array if (empty($user_name)) { array_push($errors, "Username is required"); } if (empty($user_email)) { array_push($errors, "Email is required"); } if (empty($user_pass1)) { array_push($errors, "Password is required"); } if ($user_pass1 != $user_pass2) { array_push($errors, "The two passwords do not match"); } // check the database a user does not already exist with the same username and/or email $user_check_query = "SELECT * FROM users WHERE user_name='$user_name' OR user_email='$user_email' LIMIT 1"; $result = mysqli_query($db_sysgo, $user_check_query); $user = mysqli_fetch_assoc($result); if ($user) { // if user exists if ($user['user_name'] === $user_name) { array_push($errors, "Username already exists"); } if ($user['user_email'] === $user_email) { array_push($errors, "email already exists"); } } // Register user if there are no errors if (count($errors) == 0) { //encrypt the password $user_pass = md5($user_pass1); $query = "INSERT INTO users (user_name, user_email, user_pass) VALUES('$user_name', '$user_email', '$user_pass')"; mysqli_query($db_sys, $query); $_SESSION['user_name'] = $user_name; $_SESSION['success'] = "You are now logged in"; header('location: index.php'); } } // LOGIN USER if (isset($_POST['login'])) { $user_name = mysqli_real_escape_string($db_sys, $_POST['user_name']); $user_pass = mysqli_real_escape_string($db_sys, md5($_POST['user_pass'])); if (empty($user_name)) { array_push($errors, "Username is required"); } if (empty($user_pass)) { array_push($errors, "Password is required"); } if (count($errors) == 0) { $query = "SELECT * FROM users WHERE user_name='$user_name' AND user_pass='$user_pass'"; echo $query; // echo mysqli_num_rows($db_sys, $results); $result = $db_sys->query($query); // $linhas = $result->num_rows; // echo $linhas; if (($linhas = $result->num_rows) == 1) { $_SESSION['user_name'] = $user_name; $_SESSION['success'] = "You are now logged in"; // header('location: index.php'); }else { // AQUI ESTÁ O ERRO QUE MOSTRA ---->>>> array_push($errors, "Wrong username/password"); } } } ?> <?php if (count($errors) > 0) : ?> <div class="error"> <?php foreach ($errors as $error) : ?> <p><?php echo $error ?></p> <?php endforeach ?> </div> <?php endif ?> Claro que mudei o nome do BD pois o nome que estava usando era sys e creio que não pode usar esse nome da tabela. Deve ser um nome reservado. Ponto de pesquisa: https://www.php.net/manual/en/mysqli-result.num-rows.php
  3. Alyson Ronnan Martins

    Login incorreto

    Na sua tela de login não encontrei o campo email???
  4. Dividir o problema pode te ajudar a resolver
  5. Public Sub cmdLocalizarColuna() Linha = ActiveCell.Column + 29 'Linha atual Range("G" & Linha).Value = "Seu texto" End Sub Olha se funciona.
  6. para achar a ultima linha eu uso: Linha = Sheets("SuaPlanilha").cells(Rows.Count, "A").end(xlup).row 'Ultima linha da Coluna A
  7. Segue a planilha que fiz usando a ideia: Receita(macro) Public Sub cmdNecessidade() Dim uLinhaProgramacao As Long Dim uLinhaEstrutura As Long Dim uLinhaNecessidade As Long Dim x As Long, y As Long, z As Long, w As Long Dim Produto As String Dim Material As String Dim Qtd As Double Dim NesSemana As Double Dim NesTotal As Double 'Limpar tabela cmdLimparNecessidade uLinhaProgramacao = Sheets("Programação").Cells(Rows.Count, "A").End(xlUp).Row uLinhaEstrutura = Sheets("Estrutura").Cells(Rows.Count, "A").End(xlUp).Row For x = 3 To uLinhaProgramacao Step 1 Produto = Sheets("Programação").Cells(x, "A").Value For z = 2 To uLinhaEstrutura Step 1 If Produto = Sheets("Estrutura").Cells(z, "A").Value Then 'Verificar se o material já foi programado uLinhaNecessidade = Sheets("Necessidade").Cells(Rows.Count, "A").End(xlUp).Row + 1 Material = Sheets("Estrutura").Cells(z, "B").Value Qtd = Sheets("Estrutura").Cells(z, "C").Value For w = 3 To uLinhaNecessidade Step 1 If Material = Sheets("Necessidade").Cells(w, "A").Value Then uLinhaNecessidade = w End If Next w 'Verifica se o material não foi preenchido If Sheets("Necessidade").Cells(uLinhaNecessidade, "A").Value = "" Then Sheets("Necessidade").Cells(uLinhaNecessidade, "A").Value = Material End If For y = 2 To 7 Step 1 'Coluna NesSemana = Sheets("Programação").Cells(x, y).Value NesTotal = (Qtd * NesSemana) + Sheets("Necessidade").Cells(uLinhaNecessidade, y).Value 'Lançar informações: Sheets("Necessidade").Cells(uLinhaNecessidade, y).Value = NesTotal Next y 'Debug.Print Produto & " - " & Sheets("Estrutura").Cells(z, "B").Value & ":" & Sheets("Estrutura").Cells(z, "C").Value End If Next z Next x End Sub Lógica que fiz para encontra os materiais do bolo ^^
  8. Opa @Fabio012. Boa tarde ^^ Queria você já tem conhecimento de usar os macro ou quer ver um código para entender melhor a sua ideia. Se possível poderia disponibilizar planilha para tentar o código?
  9. Boa tarde. @Carla Fagundes. Esta tentado re-abrir a planilha?
  10. Boa tarde. @jvg.ferrari. Como pensou em fazer?
  11. Muito complexo kkkk. Teria como fazer uma planilha só para exemplificar melhor a sua ideia? Podendo ser apenas foto. Exemplo:
  12. Boa tarde @GUSTAVO2511. Vamos definir o "endereço": Planilha: Setup Coluna: A Linha: 2 Então no VBA o endereço fica: Sheets("Setup").Range("A2").value ou Sheets("Setup").Cells(2, "A").value
  13. Boa tarde @knephk. Nunca usei um link do tipo DDE. Precisa fazer um teste para identificar quem esta acionando quando a alteração é gerada ela atualização. Vamos dividor o problema em dois. 1-Momento em que a alteração é realizada (pela atualização do link DDE). 2-Chamar o valor abaixo, entre as linhas "A3:A100". 1: Como não tenho como testar quando a alteração é realizada preciso que você tente descobrir ai. Exemplos: Dentro da sua planilha você pode agenda eventos para alterações(change) ou para calculos(Calcule). Sendo assim tenta colocar um código para exibir mensagem para cada alteração. Exemplo: Depois de realizar alteração aparece a mensagem: Claro que seu projeto pode não exibir mensagem no "Change" então precisa testar os outros também para ver quando atualizar e se vai aparecer mensagem.
  14. Como não consigo ver o seu projeto e imaginar como vai ser esse momento de "atualização do valor. Segue abaixo o código Public Sub cmd() Dim Linha Linha = fnPesquisarPosicao(Range("A1").Value) cCentralizarCampo (Linha) End Sub Public Function fnPesquisarPosicao(valor) For x = 3 To 103 Step 1 If Cells(x, "A").Value = valor Then fnPesquisarPosicao = x End If Next x End Function Public Sub cCentralizarCampo(Linha) With Range("A" & Linha) .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With End Sub Logo após envio a planilha usada para teste: https://drive.google.com/open?id=1FI_pmBF2ZAXM_aCczR6bxKHWqQfq8ORK
  15. duvida na palavra "centralizado": é assim?
  16. manda um exemplo para eu criar agora aqui. (tipo a tabela preenchida para ver aonde vai) Vou ficar acordado até as 11:50 hoje esse negócio sai kkkkk
  17. Teria como colocar um exemplo manual "pequeno" exemplo.
  18. Não entendi com o valor vai para baixo kkkk
  19. Tenta usar esse comando: Sub GrabLastNames() 'dimension (set aside memory for) our variables Dim objIE As InternetExplorer Dim ele As Object Dim y As Integer 'start a new browser instance Set objIE = New InternetExplorer 'make browser visible objIE.Visible = True 'navigate to page with needed data objIE.navigate "https://seu site" 'wait for page to load Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop 'we will output data to excel, starting on row 1 y = 1 'look at all the 'tr' elements in the 'table' with id 'myTable', 'and evaluate each, one at a time, using 'ele' variable For Each ele In objIE.document.getElementsByTagName("title") 'show the text content of 'tr' element being looked at Debug.Print ele.textContent 'repeat until last ele has been evaluated Next 'save the Excel workbook 'ActiveWorkbook.Save End Sub
  20. O excel atual tem mais de um arquivo aberto? Tentou abrir somente ele e fazer a execução do seu código?
  21. Boa tarde @pengo. Como não tenho ideia de como é sua planilha vou bolar uma tabela que faça a alteração como descreveu: Code: Public Sub CCCVBA() Dim nowValue 'Olha o valor da célula atual: nowValue = ActiveCell.Value 'Vai executar a formatação de acordo com o valor If nowValue > 0 Then If nowValue > 0 And nowValue <= 11 Then formatationCell ("Vermelho") 'Chama o "sub" formatar célula ElseIf nowValue >= 12 Then formatationCell ("Verde") End If End If End Sub Public Sub formatationCell(typeValue As String) 'Comandos para centrar e mudar a cor esta na parte inferior With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic 'Critério aqui If typeValue = "Verde" Then .ThemeColor = xlThemeColorAccent6 ElseIf typeValue = "Vermelho" Then .Color = 255 End If .TintAndShade = 0 .PatternTintAndShade = 0 End With End Sub https://drive.google.com/open?id=1JrWidD11BwWMtNjZjukg_kZl3J3fo6H8
  22. Boa tarde @MarcosSyq. Posso te dar uma ajuda se ainda estiver com questões kkkk mandar uma comentário aqui para nós irmos descutindo.
  23. Boa tarde. Poderia me tirar duvida sobre seu projeto?
  24. Não entendi a duvida para ajudar. Tentar fazer uma planilha (excel) com a fórmula para ver se entendo ^^
×
×
  • Criar Novo...