Ir para conteúdo
Fórum Script Brasil
  • 0

envio de formulário de cadastro com redirecionamento


Siames

Pergunta

Pessoal boa tarde.

Não entendo muito de PHp, vou buscando e configurando.

Peguei um script onde faço o cadastro e ele envia um e-mail de confirmação e recarrega a tela.

mas quando recarrega vem isso na tela do site.

2025-08-04 15:01:02 SERVER -> CLIENT: 220 ESMTP smtp.hostinger.com
2025-08-04 15:01:02 CLIENT -> SERVER: EHLO meucarrobrasil.com.br
2025-08-04 15:01:02 SERVER -> CLIENT: 250-smtp.hostinger.com250-PIPELINING250-SIZE 48811212250-ETRN250-AUTH PLAIN LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250-DSN250 CHUNKING
2025-08-04 15:01:02 CLIENT -> SERVER: AUTH LOGIN
2025-08-04 15:01:02 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2025-08-04 15:01:02 CLIENT -> SERVER: [credentials hidden]
2025-08-04 15:01:02 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2025-08-04 15:01:02 CLIENT -> SERVER: [credentials hidden]
2025-08-04 15:01:02 SERVER -> CLIENT: 235 2.7.0 Authentication successful
2025-08-04 15:01:02 CLIENT -> SERVER: MAIL FROM:<[email protected]>
2025-08-04 15:01:02 SERVER -> CLIENT: 250 2.1.0 Ok
2025-08-04 15:01:02 CLIENT -> SERVER: RCPT TO:<[email protected]>
2025-08-04 15:01:02 SERVER -> CLIENT: 250 2.1.5 Ok
2025-08-04 15:01:02 CLIENT -> SERVER: DATA
2025-08-04 15:01:02 SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
2025-08-04 15:01:02 CLIENT -> SERVER: Date: Mon, 4 Aug 2025 12:01:02 -0300
2025-08-04 15:01:02 CLIENT -> SERVER: To: "[email protected]" <[email protected]>
2025-08-04 15:01:02 CLIENT -> SERVER: From: "[email protected]" <[email protected]>
2025-08-04 15:01:02 CLIENT -> SERVER: Reply-To: "[email protected]" <[email protected]>
2025-08-04 15:01:02 CLIENT -> SERVER: Subject: =?iso-8859-1?Q?Confirma=E7=E3o_de_Cadastro_de_Vendedor?=
2025-08-04 15:01:02 CLIENT -> SERVER: Message-ID: <[email protected]>
2025-08-04 15:01:02 CLIENT -> SERVER: X-Mailer: PHPMailer 6.9.1 (https://github.com/PHPMailer/PHPMailer)
2025-08-04 15:01:02 CLIENT -> SERVER: MIME-Version: 1.0
2025-08-04 15:01:02 CLIENT -> SERVER: Content-Type: text/html; charset=iso-8859-1
2025-08-04 15:01:02 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2025-08-04 15:01:02 CLIENT -> SERVER:
2025-08-04 15:01:02 CLIENT -> SERVER:
2025-08-04 15:01:02 CLIENT -> SERVER: Obrigado por ser cadastrar!<br>
2025-08-04 15:01:02
2025-08-04 15:01:02 CLIENT -> SERVER: Clique neste link para ativar sua conta:<br>
2025-08-04 15:01:02 CLIENT -> SERVER: <a href="http://meucarrobrasil.com.br/[email protected]&token=4fffd328c87b1fcd9addaac8c67d6f1a">http://meucarrobrasil.com.br/[email protected]&token=4fffd328c87b1fcd9addaac8c67d6f1a</a>
2025-08-04 15:01:02 CLIENT -> SERVER:
2025-08-04 15:01:02 CLIENT -> SERVER: .
2025-08-04 15:01:04 SERVER -> CLIENT: 250 2.0.0 Ok: queued as 4bwfrZ6YL9z5Z5qk
2025-08-04 15:01:04 CLIENT -> SERVER: QUIT
2025-08-04 15:01:04 SERVER -> CLIENT: 221 2.0.0 Bye

 

O e-mail vem certo, mas não sei como oculto isso

vou colocar o script dessa tela.

<?php 
require_once('header.php'); 
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
?>
<?php
$statement = $pdo->prepare("SELECT * FROM tbl_settings WHERE id=1");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);                            
foreach ($result as $row) {
    $banner_registration = $row['banner_registration'];
}

$statement = $pdo->prepare("SELECT * FROM tbl_settings WHERE id=1");
$statement->execute();
$result = $statement->fetchAll(PDO::FETCH_ASSOC);                            
foreach ($result as $row) 
{
    $recaptcha_site_key = $row['recaptcha_site_key'];
    $recaptcha_status = $row['recaptcha_status'];
}
?>

<?php
if (isset($_POST['form1'])) {

    $valid = 1;

    if(empty($_POST['seller_name'])) {
        $valid = 0;
        $error_message .= "O Nome não pode estar vazio!\\n";
    }

    if(empty($_POST['seller_email'])) {
        $valid = 0;
        $error_message .= "O E-mail não pode estar vazio!\\n";
    } else {
        if (filter_var($_POST['seller_email'], FILTER_VALIDATE_EMAIL) === false) {
            $valid = 0;
            $error_message .= 'Insira um E-mail válido.\\n';
        } else {
            $statement = $pdo->prepare("SELECT * FROM tbl_seller WHERE seller_email=?");
            $statement->execute(array($_POST['seller_email']));
            $total = $statement->rowCount();                            
            if($total) {
                $valid = 0;
                $error_message .= 'O E-mail informado já está cadastrado em nosso sistema!\\n';
            }
        }
    }

    if(empty($_POST['seller_address'])) {
        $valid = 0;
        $error_message .= "O Endereço não pode estar vazio!\\n";
    }

    if(empty($_POST['seller_city'])) {
        $valid = 0;
        $error_message .= "A Cidade não pode estar vazio!\\n";
    }

    if(empty($_POST['seller_country'])) {
        $valid = 0;
        $error_message .= "O País não pode estar vazio!\\n";
    }

    if( empty($_POST['seller_password']) || empty($_POST['seller_re_password']) ) {
        $valid = 0;
        $error_message .= "A Senha não pode estar vazia!\\n";
    }

    if( !empty($_POST['seller_password']) && !empty($_POST['seller_re_password']) ) {
        if($_POST['seller_password'] != $_POST['seller_re_password']) {
            $valid = 0;
            $error_message .= "As Senhas não Conferem!\\n";    
        }        
    }

    if($recaptcha_status == 'On'):
        $g_recaptcha = $_POST['g-recaptcha-response'];
        if($g_recaptcha == '') {
            $valid = 0;
            $error_message .= 'Verifique o Código!\\n';
        }
    endif;

    if($valid == 1) {

        $token = md5(uniqid(rand(), true));
        $now = time();

        // saving into the database
        $statement = $pdo->prepare("INSERT INTO tbl_seller (seller_name,seller_email,seller_phone,seller_address, seller_city,seller_state,seller_country,seller_password,seller_token,seller_time,seller_access) VALUES (?,?,?,?,?,?,?,?,?,?,?)");
        $statement->execute(array($_POST['seller_name'],$_POST['seller_email'],$_POST['seller_phone'],nl2br($_POST['seller_address']),$_POST['seller_city'],$_POST['seller_state'],$_POST['seller_country'],md5($_POST['seller_password']),$token,$now,0));
       
        $verify_link = BASE_URL.'verify.php?email='.$_POST['seller_email'].'&token='.$token;
        $msg = '
            Obrigado por ser cadastrar!<br>
            Sua conta foi criada, você pode fazer login com as suas credenciais depois de ativar sua conta clicando no link abaixo.<br><br>
            Clique neste link para ativar sua conta:<br>
            <a href="'.$verify_link.'">'.$verify_link.'</a>';

        
        $statement = $pdo->prepare("SELECT * FROM tbl_setting_email WHERE id=1");
        $statement->execute();
        $result = $statement->fetchAll();                            
        foreach ($result as $row) 
        {
            $send_email_from  = $row['send_email_from'];
            $receive_email_to = $row['receive_email_to'];
            $smtp_host        = $row['smtp_host'];
            $smtp_port        = $row['smtp_port'];
            $smtp_username    = $row['smtp_username'];
            $smtp_password    = $row['smtp_password'];
        }

        //Load Composer's autoloader
        require 'vendor/autoload.php';

        //Create an instance; passing `true` enables exceptions
        $mail = new PHPMailer(true);

        try {
            //Server settings
            $mail->SMTPDebug = SMTP::DEBUG_SERVER;                      //Enable verbose debug output
            $mail->isSMTP();                                            //Send using SMTP
            $mail->Host       = $smtp_host;                                //Set the SMTP server to send through
            $mail->SMTPAuth   = true;                                   //Enable SMTP authentication
            $mail->Username   = $smtp_username;                            //SMTP username
            $mail->Password   = $smtp_password;                            //SMTP password
            $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;            //Enable implicit TLS encryption
            $mail->Port       = $smtp_port;                                //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS`

            //Recipients
            $mail->setFrom($send_email_from, $send_email_from);
            $mail->addAddress($_POST['seller_email'], $_POST['seller_email']);            //Add a recipient
            $mail->addReplyTo($receive_email_to, $receive_email_to);

            //Content
            $mail->isHTML(true);                                          //Set email format to HTML
            $mail->Subject = mb_convert_encoding('Confirmação de Cadastro de Vendedor', 'ISO-8859-1', 'UTF-8');
            $mail->Body    = mb_convert_encoding($msg, 'ISO-8859-1', 'UTF-8');

            $mail->send();
        } catch (Exception $e) {
            echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
        }

        unset($_POST['seller_name']);
        unset($_POST['seller_email']);
        unset($_POST['seller_phone']);
        unset($_POST['seller_address']);
        unset($_POST['seller_city']);
        unset($_POST['seller_state']);
        unset($_POST['seller_country']);

        $success_message = 'Seu Cadastro está concluído. Acesse seu E-mail para confirmar seu Cadastro.';
    }
}
?>

<div class="banner-slider" style="background-image: url(<?php echo BASE_URL.'assets/uploads/'.$banner_registration; ?>)">
    <div class="bg"></div>
    <div class="bannder-table">
        <div class="banner-text">
            <h1>Cadastro de Vendedor</h1>
        </div>
    </div>
</div>

<div class="login-area bg-area">
    <div class="container">
        <div class="row">
        
            <div class="col-md-offset-4 col-md-5">
                
                <?php
                if($error_message != '') {
                    echo "<script>alert('".$error_message."')</script>";
                }
                if($success_message != '') {
                    echo "<script>alert('".$success_message."')</script>";
                }
                ?>
                <div class="login-form">
                    
                    <form action="" method="post">

                        <div class="form-row">
                            
                            <div class="form-group">
                                <label for="">Nome Completo ou Nome da Garagem*</label>
                                <input type="text" class="form-control" name="seller_name" placeholder="Nome Completo" value="<?php if(isset($_POST['seller_name'])){echo $_POST['seller_name'];} ?>">
                            </div>

                            <div class="form-group">
                                <label for="">E-mail*</label>
                                <input type="email" class="form-control" name="seller_email" placeholder="Endereço de E-mail" value="<?php if(isset($_POST['seller_email'])){echo $_POST['seller_email'];} ?>">
                            </div>

                            <div class="form-group">
                                <label for="">Telefone (com DDD)*</label>
                                <input type="text" class="form-control" name="seller_phone" placeholder="Seu Whatsapp" value="<?php if(isset($_POST['seller_phone'])){echo $_POST['seller_phone'];} ?>">
                            </div>

                            <div class="form-group">
                                <label for="">Endereço*</label>
                                <textarea name="seller_address" class="form-control" cols="30" rows="10" placeholder="Seu Endereço/Endereço de sua Loja" style="height:120px;"><?php if(isset($_POST['seller_address'])){echo $_POST['seller_address'];} ?></textarea>
                            </div>

                            <div class="form-group">
                                <label for="">País*</label>
                                <input type="text" class="form-control" name="seller_country" placeholder="País" value="<?php if(isset($_POST['seller_country'])){echo $_POST['seller_country'];}else{echo "Brasil";} ?>" readonly>
                            </div>

                            <div class="form-group">
                                <label for="">Estado*</label>
                                    <select id="seller_state" name="seller_state" class="form-control" onchange="searchCities(this.value)">
                                        <option value="AC" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='AC') {echo 'selected';}} ?>>Acre</option>
                                        <option value="AL" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='AL') {echo 'selected';}} ?>>Alagoas</option>
                                        <option value="AP" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='AP') {echo 'selected';}} ?>>Amapá</option>
                                        <option value="AM" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='AM') {echo 'selected';}} ?>>Amazonas</option>
                                        <option value="BA" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='BA') {echo 'selected';}} ?>>Bahia</option>
                                        <option value="CE" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='CE') {echo 'selected';}} ?>>Ceará</option>
                                        <option value="DF" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='DF') {echo 'selected';}} ?>>Distrito Federal</option>
                                        <option value="ES" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='ES') {echo 'selected';}} ?>>Espírito Santo</option>
                                        <option value="GO" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='GO') {echo 'selected';}} ?>>Goiás</option>
                                        <option value="MA" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='MA') {echo 'selected';}} ?>>Maranhão</option>
                                        <option value="MT" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='MT') {echo 'selected';}} ?>>Mato Grosso</option>
                                        <option value="MS" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='MS') {echo 'selected';}} ?>>Mato Grosso do Sul</option>
                                        <option value="MG" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='MG') {echo 'selected';}} ?>>Minas Gerais</option>
                                        <option value="PA" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='PA') {echo 'selected';}} ?>>Pará</option>
                                        <option value="PB" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='PB') {echo 'selected';}} ?>>Paraíba</option>
                                        <option value="PR" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='PR') {echo 'selected';}} ?>>Paraná</option>
                                        <option value="PE" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='PE') {echo 'selected';}} ?>>Pernambuco</option>
                                        <option value="PI" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='PI') {echo 'selected';}} ?>>Piauí</option>
                                        <option value="RJ" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='RJ') {echo 'selected';}} ?>>Rio de Janeiro</option>
                                        <option value="RN" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='RN') {echo 'selected';}} ?>>Rio Grande do Norte</option>
                                        <option value="RS" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='RS') {echo 'selected';}} ?>>Rio Grande do Sul</option>
                                        <option value="RO" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='RO') {echo 'selected';}} ?>>Rondônia</option>
                                        <option value="RR" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='RR') {echo 'selected';}} ?>>Roraima</option>
                                        <option value="SC" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='SC') {echo 'selected';}} ?>>Santa Catarina</option>
                                        <option value="SP" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='SP') {echo 'selected';}} ?>>São Paulo</option>
                                        <option value="SE" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='SE') {echo 'selected';}} ?>>Sergipe</option>
                                        <option value="TO" <?php if(isset($_POST['seller_state']))  {if($_POST['seller_state']=='TO') {echo 'selected';}} ?>>Tocantins</option>
                                    </select>
                            </div>

                            <div class="form-group">
                                <label for="">Cidade*</label>
                                <select id="seller_city" name="seller_city" class="form-control" >
                                    <option value=null selected>Selecione a Cidade</option>
                                </select>
                            </div>
                            
                            <div class="form-group">
                                <label for="">Senha*</label>
                                <input type="password" class="form-control" name="seller_password" placeholder="Senha">
                            </div>

                            <div class="form-group">
                                <label for="">Repita a Senha*</label>
                                <input type="password" class="form-control" name="seller_re_password" placeholder="Repita a Senha">
                            </div>

                            <?php if($recaptcha_status == 'On'): ?>
                            <div class="form-group">
                                <div class="g-recaptcha" data-sitekey="<?php echo $recaptcha_site_key; ?>"></div>
                            </div>
                            <?php endif; ?>
                            
                            <button type="submit" class="btn btn-primary" name="form1">Cadastre-se</button>
                            
                        </div>

                    </form>

                </div>
            </div>

            <div class="login-here">
                <h3><i class="fa fa-user-circle-o"></i> Já é cadastrado? <a href="login.php">Efetue o Login aqui!</a></h3>
            </div>            
                
        </div>
    </div>
</div>
    
<?php require_once('footer.php'); ?>

 

pessoal agradeço pela ajuda

 

 

erro.png

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0

Você precisa tirar duas linhas do seu código:

<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;  // ---------------------> tira isso
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php'; // Certifique-se de que o autoload está correto

$mail = new PHPMailer(true);

try {
    // Configurações do servidor SMTP do Gmail
    $mail->SMTPDebug = SMTP::DEBUG_SERVER; // ---------------------> tira isso
    $mail->isSMTP();
    $mail->Host       = 'smtp.gmail.com';
    $mail->SMTPAuth   = true;
    $mail->Username   = '[email protected]';       // Seu e-mail Gmail
    $mail->Password   = 'abcd abcd abcd abcd'; // senha de app
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
    $mail->Port       = 465;

    // Remetente e destinatário
    $mail->setFrom('[email protected]', 'Frank K Hosaka');
    $mail->addAddress('[email protected]', 'Frank K Hosaka');

    // Conteúdo do e-mail
    $mail->CharSet='UTF-8';
    $mail->Encoding='base64';
    $mail->Subject = 'Teste de envio via PHPMailer';
    $mail->Body    = 'Olá Frank, este é um teste de envio usando PHPMailer';
    $mail->send();
    echo 'Mensagem enviada com sucesso!';
} catch (Exception $e) {
    echo "Erro ao enviar: {$mail->ErrorInfo}";
}
?>

 

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,5k
    • Posts
      652,4k
×
×
  • Criar Novo...