I can’t authenticate the purchase

Asked

Viewed 40 times

0

Like, I want to do an authentication when finishing the purchase on my site, taking name, email and password. I know you have to do a if but I don’t know how to do it, if anyone can help I’m grateful!!

Code:

<div class="contact">
    <div class="container">
        <h1>Finalizar Compra</h1>
        <div class="contact-form">
            <div class="col-md-8 contact-grid">
                <form action="mailcl.php" method="post">
                    <div class="container">
                        <div class="check">  
                             <h1>Revisão</h1>
                             <br />
                             <br />
                             <br />
                            <?php
                                echo 'Nome';
                                echo '<input type="text" name="nome">';
                                echo'Email';
                                echo '<input type="text" name="email" >';
                                echo'Senha';
                                echo '<input type="password" name="senha" >';
                            ?>
                            <div class="send">
                                <input type="submit" value="Comprar">
                            </div>
                        </div>
                     </div>
                </form>
            </div>
        </div>
    </div>
</div>

<!-- //Codigo onde a compra é enviada no email -->
<html>
    <head>
        <title>Autenticando usuario</title>
        <style type="text/css"></style>
        <script type="text/javascript">
            function LoginSucessfully(){
                setTimeout("window.location='index.php'",5000);
            }
        </script>
    </head>
    <body>
    </body>
</html>
<?php 
    require "PHPMailer-master/PHPMailerAutoload.php";

    $nome = $_POST['nome'];
    $email = $_POST['email'];
    $tabela = $_POST['tabela'];

    $mail = new PHPMailer;

    //$mail->SMTPDebug = 3;                               // Enable verbose debug output

    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'smtp.gmail.com';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = '[email protected]';                 // SMTP username
    $mail->Password = '**********';                           // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 587;                                    // TCP port to connect to

    $mail->setFrom('[email protected]', 'MarvelDC');
    $mail->addAddress('[email protected]');  
    $mail->addAddress($email);    // Add a recipient
    $mail->isHTML(true); // Set email format to HTML

    $mail->Subject =  $email;
    $mail->Body    = $nome;
    $mail->Body    = $tabela;

    $mail->Subject = "Compra efeituada com sucesso!!!";
    $mail->Body  = "<!DOCTYPE html>
        <html lang='pt-br'>
            <head>
                <meta charset='utf-8'/>
                <meta content='width=device-width, initial-scale=1, maximum-scale=1' name='viewport'>
                <title>Título da Página (Estrutura básica de uma página com HTML 5)</title>
                <link href='css/seu-stylesheet.css' rel='stylesheet'/>
                <script src='scripts/seu-script.js'></script>
            </head>
            <body>
                <font color='black' face='arial'  size='4px'>Olá, $nome<p>
                    <h3>Recebemos o seu pedido!</h3><p> Deposite Nessa Conta o Valor da compra: 4752564814 01 Apos o deposito entraremos em contato para o envio!
                </font>

                $tabela
            </body>
        </html>";

    $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

    if(!$mail->send()) {
        echo"<center><font color = black>Email ou senha invalidos!!Aguarde um instante para tentar novamente.</font></center>";
            echo "<script>LoginFailed()</script>";
    }else{
        echo"<br /><br />";
        echo"<center><h1><font color='black' face='arial' >O email foi enviado com sucesso!Aguarde um instante que voce sera redirecionado a pagina Home.</font></h1></center>";
        echo"<br /><br />";
        echo"<center><img src='images/carregamento.gif'></center>";
        echo"<script>LoginSucessfully()</script>";
    }
?>
  • Is this all in one file? And which part you want this authentication?

  • I want in the form part in the first code in name, email and password

  • Do you want to check if there is a registration with name, email and password in a database? Explain this better when authenticating the purchase

  • Yes that’s right I want to show if the name , email and password entered is the same as the one in the bank.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.