Advertisement
Guest User

Untitled

a guest
Dec 19th, 2015
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. *** SCRIPTI RECUPERAÇÃO *****
  2.  
  3. <?php
  4.  
  5. require("libs/class.phpmailer.php"); // Certifique-se de que o caminho está certo.
  6. require_once("accfunction.php");
  7. require_once("dbaSis.php");
  8.  
  9. $userid = trim($_POST['userid']);
  10. $email = trim($_POST['email']);
  11. $pergunta = trim($_POST['pergunta']);
  12. $resposta = trim($_POST['resposta']);
  13.  
  14.  
  15. $bh2 = abrirconta($userid);
  16. $senha = (hexTobin(substr($bh2,32,28)));
  17.  
  18.  
  19. $mail = new PHPMailer();
  20. $mail->SetLanguage("br", "libs/"); // Linguagem
  21. $mail->SMTP_PORT = "465"; // Porta do SMTP
  22. $mail->SMTPSecure = "tls"; // Tipo de comunicação segura
  23.  
  24. $mail->IsSMTP();
  25. $mail->Host = "smtp.gmail.com"; // Endereço do servidor SMTP
  26. $mail->SMTPAuth = true; // Requer autenticação?
  27. $mail->Username = "seuemail@gmail.com"; // Usuário SMTP
  28. $mail->Password = "suasenha"; // Senha do usuário SMTP
  29.  
  30. $mail->From = "seuemail@gmail.com"; // E-mail do remetente
  31. $mail->FromName = "SUPORT"; // Nome do remetente
  32. $mail->AddAddress("".$email.""); // E-mail do destinatário
  33.  
  34. $mail->IsHTML(true);
  35. $mail->Subject = "Recuperação de senha"; //assunto da msg
  36. $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
  37.  
  38. if(!$mail->Send()) {
  39. echo "Erro: " . utf8_decode($mail->ErrorInfo);
  40. } echo "Email enviado com sucesso!";
  41.  
  42. ?>
  43.  
  44. ***** SCRIPTI DBASIS ****
  45.  
  46. <?php
  47. require('iniSis.php');
  48.  
  49. $conn = mysql_connect(HOST, USER, PASS) or die ('Erro ao conectar: '.mysql_error());
  50. $dbsa = mysql_select_db(DBSA) or die ('Erro ao selecionar banco: '.mysql_error());
  51.  
  52. /*****************************
  53. FUNÇÃO DE CADASTRO NO BANCO
  54. *****************************/
  55.  
  56. function create($tabela, array $datas){
  57. $fields = implode(", ",array_keys($datas));
  58. $values = "'".implode("', '",array_values($datas))."'";
  59. $qrCreate = "INSERT INTO {$tabela} ($fields) VALUES ($values)";
  60. $stCreate = mysql_query($qrCreate) or die ('Erro ao cadastrar em '.$tabela.' '.mysql_error());
  61.  
  62. if($stCreate){
  63. return true;
  64. }
  65. }
  66.  
  67. /*****************************
  68. FUNÇÃO DE CADASTRO NO BANCO
  69. *****************************/
  70.  
  71. function read($tabela, $cond = NULL){
  72. $qrRead = "SELECT * FROM {$tabela} {$cond}";
  73. $stRead = mysql_query($qrRead) or die ('Erro ao ler em '.$tabela.' '.mysql_error());
  74. $cField = mysql_num_fields($stRead);
  75. global $resultado;
  76. for($y = 0; $y < $cField; $y++){
  77. $names[$y] = mysql_field_name($stRead,$y);
  78. }
  79. for($x = 0; $res = mysql_fetch_assoc($stRead); $x++){
  80. for($i = 0; $i < $cField; $i++){
  81. $resultado[$x][$names[$i]] = $res[$names[$i]];
  82. }
  83. }
  84.  
  85. return $resultado;
  86. }
  87.  
  88. /*****************************
  89. FUNÇÃO DE EDIÇÃO NO BANCO
  90. *****************************/
  91.  
  92. function update($tabela, array $datas, $where){
  93. foreach($datas as $fields => $values){
  94. $campos[] = "$fields = '$values'";
  95. }
  96.  
  97. $campos = implode(", ",$campos);
  98. $qrUpdate = "UPDATE {$tabela} SET $campos WHERE {$where}";
  99. $stUpdate = mysql_query($qrUpdate) or die ('Erro ao atualizar em '.$tabela.' '.mysql_error());
  100.  
  101. if($stUpdate){
  102. return true;
  103. }
  104.  
  105. }
  106.  
  107. /*****************************
  108. FUNÇÃO DE DELETAR NO BANCO
  109. *****************************/
  110.  
  111. function delete($tabela, $where){
  112. $qrDelete = "DELETE FROM {$tabela} WHERE {$where}";
  113. $stDelete = mysql_query($qrDelete) or die ('Erro ao deletar em '.$tabela.' '.mysql_error());
  114. }
  115. ?>
  116.  
  117. ***** SCRIPTI INISIS *****
  118.  
  119. <?php
  120. //DEFINE BANCO DEDADOS
  121. define("HOST","localhost");
  122. define("USER","root");
  123. define("PASS","");
  124. define("DBSA","newdb");
  125.  
  126. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement