Viewing file: esqueci.php (8.32 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php ############################################################################# # Nome: esqueci_senha.php # # System: Irpen # # Criado por: Breno Henrique Vivarelli # # Empresa: Netnigro # # E-mail: breno@netnigro.com.br # # Descrição: Envia nova senha para o usuário # # Histórico: # # . 24/06/2008 - Breno Henrique Vivarelli # # Criação da Página # ############################################################################# // Includes include("config/config.php"); include(INCLUDES . "conexaoBD.php"); include(INCLUDES . "funcoes_uteis.php"); if(isset($_POST["btnOk"])) { $email = $_POST["txtEmail"]; $email_confirmado = $_POST["txtEmailConfirmado"]; if(strcmp($email,$email_confirmado) == 0) { $senha = GeraSenhaAleatoria(); $sql = "SELECT * FROM contatos " . "WHERE CON_Email = '$email' "; $rs_usuario = $conexao->query($sql); $usuario = $rs_usuario->fetch_array(); $nome_usuario = $usuario["CON_Descricao"]; $sql = "UPDATE contatos " . "SET CON_Senha = MD5('$senha') " . "WHERE CON_Email = '$email' "; $conexao->query($sql); if($conexao->affected_rows > 0) { $body.= " ============================================================ "; $body.= "\n<br>"; $body.= " SOLICITAÇÃO PARA CRIAÇÃO DE NOVA SENHA DE ACESSO AO SISTEMA "; $body.= "\n<br>"; $body.= " ============================================================ "; $body.= "\n<br>"; $body.= "\n<br>"; $body.= "<font face='arial' size='2'> Caro(a) <b> $nome_usuario</b>,"; $body.= "\n<br>"; $body.= "\n<br>"; $body.= " Conforme solicitado, estamos enviando sua nova senha para acesso "; $body.= " Sistema IRPEN: "; $body.= "\n<br>"; $body.= "\n<br>"; $body.= " <b> Login: </b>" . $email; $body.= "\n<br>"; $body.= " <b> Senha: </b>" . $senha; $body.= "\n<br>"; $body.= "\n<br>"; $body.= "\n<br>"; $body.= "\n<br>"; $body.= " Atenciosamente," ; $body.= "\n<br>"; $body.= "\n<br>"; $headers = "From: Irpen <contato@irpepr.org.br>"; $headers .= "Bcc : cron.irpen@netnigro.com.br\n"; if(mail($email,"Acesso ao Irpen: Solicitação de nova senha",$body,$headers)) { $conexao->commit(); $tipo_msg = "msg_ok"; $msg = "Uma nova senha foi gerada e enviada ao e-mail informado."; } else { $conexao->rollback(); $tipo_msg = "msg_erro"; $msg = "O e-mail informado não é válido."; } } else { $tipo_msg = "msg_erro"; $msg = "O e-mail informado não está cadastrado no sistema."; } } else { $tipo_msg = "msg_erro"; $msg = "Confirme o e-mail corretamente."; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="css/irpen.css" type="text/css" /> <link rel="stylesheet" media="all" type="text/css" href="css/menu_dropline.css" /> <!--[if IE]> <link rel="stylesheet" media="all" type="text/css" href="css/menu_dropline_ie.css" /> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" media="all" type="text/css" href="css/menu_dropline_ie6.css" /> <![endif]--> <title>IRPEN | Instituto de Registro Civil de Pessoas Naturais do Paraná - 2010</title> <!-- <script src="scripts/delay.js" language="JavaScript"></script> --> <script type="text/javascript" src="<?= HOST;?>lib/jquery-1.2.6.js"></script> <script type="text/javascript" src="<?= HOST;?>lib/jquery.form.js"></script> <script type="text/javascript" src="<?= HOST;?>lib/email.js"></script> <script type="text/javascript" src="<?= HOST;?>scripts/esqueci_senha.js"></script> </head> <body> <div id="wrap_info_oficio"> <div id="top-bg"> </div> <div id="header"> <div id="logo"> <img src="<?= HOST;?>imagens/logo.jpg" width="250" height="72"></img> </div> </div> <!-- content-wrap starts --> <div id="content-wrap"> <table width="100%" border="0"> <tr> <td width="79%" align="left" valign="top"> <h2>ESQUECI MINHA SENHA</h2> <div id="linha_h2" > </div> <div id="conteudo_meio" style="margin-right: 10px;" > <br /> <form name="frmEsqueciSenha" id="frmEsqueciSenha" action="esqueci_senha.php" enctype="multipart/form-data" method="post"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="right" width="27%"> <strong>E-mail: </strong> </td> <td align="left" width="73%"> <input type="text" name="txtEmail" id="txtEmail" size="50"> </td> </tr> <tr> <td align="right"> <strong>Confirme o e-mail: </strong> </td> <td align="left"> <input type="text" name="txtEmailConfirmado" id="txtEmailConfirmado" size="50"> </td> </tr> <tr> <td align="center" colspan="2"> <br /> <input type="submit" name="btnOk" id="btnOk" value="Ok" class="button"/> <br /> </td> </tr> </table> <br /> <?php if((isset($msg)) && (!empty($msg))) { ?> <div class="msg_erro" align="center"> <?= $msg;?> </div> <?php } ?> <br /> </form> </div> </td> </tr> </table> </div> <!-- footer starts --> <div id="footer-wrap"> </div> </div> </body> </html>
|