在php中重复注册表单的电子邮件



如何在该代码中添加repead函数以进行电子邮件repead?

我有电子邮件的检查功能已经存在于数据库中,但我想重新输入电子邮件的电子邮件功能。我怎样才能在我的代码中做到这一点。有人能帮我吗?

<?php 
    include("includes/connect.php"); 
    if(isset($_POST['submit'])) { 
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        $... = $_POST['...'];
        if($...=='') {
           echo"<script>alert('please enter the ...')</script>";
           exit();
        }
        if($...=='') {
           echo"<script>alert('please enter the ...')</script>";
           exit();
        }
        if($...=='') {
           echo"<script>alert('please enter the ...')</script>";
           exit();
        }
        if($...=='') {
           echo"<script>alert('please enter the ...')</script>";
           exit();
        }
        $check_... = "SELECT * FROM ... where ...='$...'";
        $run = mysql_query($check_...);
        if(mysql_num_rows($run)>0) {
            echo "<script>alert('... $... is alredy exist in database , please try other ...')</script>";
            exit();
        }
        $query ="INSERT INTO ... (...,...,..., ...,...,...,...,...,...) VALUES ('$...','$...','$...', '$...','$...','$...','$...','$...,'$...')";
        if(mysql_query($query)) {
            echo "<script>alert('Registiration was succesfully!')</script>";
        }
    }
?> 

我希望这不是生产代码,因为代码有潜在的SQL注入(请检查"什么是SQL注入?")。但不管怎样,关于你的问题。你需要添加简单的检查来实现你想要的:

    ...
    if($business_name == ''){
       echo"<script>alert('please enter the usernme')</script>";
       exit();
       }
    if($email == ''){
       echo"<script>alert('please enter the email')</script>";
       exit();
       }
    //check for matching
    if($email != $emailagain){
       echo"<script>alert('entered email addresses don't match')</script>";
       exit();
       }
    $check_email = "SELECT * FROM ... where ...='$...'";
    ...

相关内容

  • 没有找到相关文章

最新更新