php Page, Do not Save On The Bank! Because?

0

The code below is inside a huge page, I need the value that the person put in "email" is inserted in the variable and so to the bank. I have already reviewed thousands of different codes but always continues with the same problem Do not write to the bank , the connection is established (without error shadow). I've reviewed the code several times, but I can not solve the problem.

<div id="boxes">

<!-- Janela Modal com caixa de diálogo -->  
<div id="dialog1" class="window">
  <div class="d-header">

    <form method="POST" action="?go=cadastrar">
    <img src="imagem.png">
        <h3>Digite seu E-mail e comece GRÁTIS !!</h3>
        <label>Consiga agora o incrível programa que irá lhe ajudar!</label>
        <input type="text" name="email" id="email" required value="E-mail" 
placeholder="E-mail" onclick="this.value=''" maxlength="60" /></a><br/>
        <input type="hidden" name="acao" value="Enviado">
        <input type="submit" name="cadastro" id="cadastro" value="Cadastrar" 
onclick="javascript:window.open('download.php?file=apostila_JAVA.pdf')"/>
<br/>

        <a href="http://echef.teccitystore.com.br/downloads.html" 
 name="fechar">Fechar[x]</a>
   <img src="logo.png">
 </form>
  </div>
  <div class="d-blank"></div>
</div>
<!-- Fim Janela Modal com caixa de diálogo -->  
</div>

<!-- Máscara para cobrir a tela -->
  <div id="mask"></div>


 <?php
 if(isset($_GET['go'])){
  if($_GET['go'] == 'cadastrar'){
    $email = $_POST['email'];

    if(empty($email)){
        echo"
            <script>
            alert('Campo está vazio');
            history.back();
            </script
        ";
    }else{
        $query1 = @msql_fetch_row(@msql_query("SELECT * FROM email WHERE = 
'$email'"));
        if($query1 == 1){
            echo "<script>
            alert('Email já existente !!');
            history.back();
           </script";
        }else{
            @mysql_query("INSERT INTO downloads (email) VALUES ('email')");
            echo "<script>
            alert('Cadastro Efetuado !!');
            history.back();
            </script";
            header("location: index.php");
            }
        }
     }
}
  ?>
    
asked by anonymous 16.08.2017 / 20:36

2 answers

0

Check the SQL commands:

$sql = "SELECT 1 FROM email WHERE = '" . $email . "' ";

$insert = "INSERT INTO downloads (email) VALUES ('" . email . "')";

Also check the closing of the SCRIPT tag.

If if empty does not work, try (email! = '') that can help you with the logic itself.

    
16.08.2017 / 21:53
0

Looking at your code in query1 there is an error in the sql string in the WHERE condition:

$query1 = @msql_fetch_row(@msql_query("SELECT * FROM email WHERE = 
'$email'"));

Change it to:

$query1 = @mysql_fetch_row(@msql_query("SELECT * FROM email WHERE email = 
'$email'"));

and also change the insert string from:

@mysql_query("INSERT INTO downloads (email) VALUES ('email')");

To:

@mysql_query("INSERT INTO downloads (email) VALUES ( $email)");

Taking a quick look was what I thought might be making a mistake. I hope I have helped!

    
16.08.2017 / 20:57