Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *** SCRIPTI RECUPERAÇÃO *****
- <?php
- require("libs/class.phpmailer.php"); // Certifique-se de que o caminho está certo.
- require_once("accfunction.php");
- require_once("dbaSis.php");
- $userid = trim($_POST['userid']);
- $email = trim($_POST['email']);
- $pergunta = trim($_POST['pergunta']);
- $resposta = trim($_POST['resposta']);
- $bh2 = abrirconta($userid);
- $senha = (hexTobin(substr($bh2,32,28)));
- $mail = new PHPMailer();
- $mail->SetLanguage("br", "libs/"); // Linguagem
- $mail->SMTP_PORT = "465"; // Porta do SMTP
- $mail->SMTPSecure = "tls"; // Tipo de comunicação segura
- $mail->IsSMTP();
- $mail->Host = "smtp.gmail.com"; // Endereço do servidor SMTP
- $mail->SMTPAuth = true; // Requer autenticação?
- $mail->Username = "seuemail@gmail.com"; // Usuário SMTP
- $mail->Password = "suasenha"; // Senha do usuário SMTP
- $mail->From = "seuemail@gmail.com"; // E-mail do remetente
- $mail->FromName = "SUPORT"; // Nome do remetente
- $mail->AddAddress("".$email.""); // E-mail do destinatário
- $mail->IsHTML(true);
- $mail->Subject = "Recuperação de senha"; //assunto da msg
- $mail->Body = "Alguém solicitou a recuperação de sua senha, se não foi você, entre em contato com nossa equipe. <br /><br /> Sua senha atual é: ".$senha.""; //mensagem
- if(!$mail->Send()) {
- echo "Erro: " . utf8_decode($mail->ErrorInfo);
- } echo "Email enviado com sucesso!";
- ?>
- ***** SCRIPTI DBASIS ****
- <?php
- require('iniSis.php');
- $conn = mysql_connect(HOST, USER, PASS) or die ('Erro ao conectar: '.mysql_error());
- $dbsa = mysql_select_db(DBSA) or die ('Erro ao selecionar banco: '.mysql_error());
- /*****************************
- FUNÇÃO DE CADASTRO NO BANCO
- *****************************/
- function create($tabela, array $datas){
- $fields = implode(", ",array_keys($datas));
- $values = "'".implode("', '",array_values($datas))."'";
- $qrCreate = "INSERT INTO {$tabela} ($fields) VALUES ($values)";
- $stCreate = mysql_query($qrCreate) or die ('Erro ao cadastrar em '.$tabela.' '.mysql_error());
- if($stCreate){
- return true;
- }
- }
- /*****************************
- FUNÇÃO DE CADASTRO NO BANCO
- *****************************/
- function read($tabela, $cond = NULL){
- $qrRead = "SELECT * FROM {$tabela} {$cond}";
- $stRead = mysql_query($qrRead) or die ('Erro ao ler em '.$tabela.' '.mysql_error());
- $cField = mysql_num_fields($stRead);
- global $resultado;
- for($y = 0; $y < $cField; $y++){
- $names[$y] = mysql_field_name($stRead,$y);
- }
- for($x = 0; $res = mysql_fetch_assoc($stRead); $x++){
- for($i = 0; $i < $cField; $i++){
- $resultado[$x][$names[$i]] = $res[$names[$i]];
- }
- }
- return $resultado;
- }
- /*****************************
- FUNÇÃO DE EDIÇÃO NO BANCO
- *****************************/
- function update($tabela, array $datas, $where){
- foreach($datas as $fields => $values){
- $campos[] = "$fields = '$values'";
- }
- $campos = implode(", ",$campos);
- $qrUpdate = "UPDATE {$tabela} SET $campos WHERE {$where}";
- $stUpdate = mysql_query($qrUpdate) or die ('Erro ao atualizar em '.$tabela.' '.mysql_error());
- if($stUpdate){
- return true;
- }
- }
- /*****************************
- FUNÇÃO DE DELETAR NO BANCO
- *****************************/
- function delete($tabela, $where){
- $qrDelete = "DELETE FROM {$tabela} WHERE {$where}";
- $stDelete = mysql_query($qrDelete) or die ('Erro ao deletar em '.$tabela.' '.mysql_error());
- }
- ?>
- ***** SCRIPTI INISIS *****
- <?php
- //DEFINE BANCO DEDADOS
- define("HOST","localhost");
- define("USER","root");
- define("PASS","");
- define("DBSA","newdb");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement