“字段列表”中的未知列“ activation_code”

时间:2019-06-09 07:38:04

标签: php

我的魔兽世界网站出现问题。在要注册的注册部分中,我会跳过此错误

Unknown column 'activation_code' in 'field list'

我创建了帐户,可以进入页面,但是在进入游戏时,它告诉我我的帐户已被阻止

Unknown column 'activation_code' in 'field list'

这是我的文件Register.php ...请帮助我

> <?php 
require_once("".$_SERVER['DOCUMENT_ROOT']."/header.php");

/*generate the code for activate the acccount*/
function random_str($length, $keyspace = '_0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
{
    $keyspace = str_shuffle($keyspace );
    $pieces = [];
    $max = mb_strlen($keyspace, '8bit') - 1;
    for ($i = 0; $i < $length; ++$i) {
        $pieces []= $keyspace[random_int(0, $max)];
    }
    return implode('', $pieces);
}
$regcode = random_str(255);
/*
$a = random_str(32);
$b = random_str(8, 'abcdefghijklmnopqrstuvwxyz');
*/
/*END genetare code*/

function encryptpw($user, $pass) {
    $user = strtoupper($user);
    $pass = strtoupper($user);
    return sha1($user.':'.$pass);
}

//store all results from query records
$results = array();

                                                $accexist = 'SELECT * FROM battlenet_accounts WHERE email = "'.$_POST['email'].'"'; 
                                                //SQL select query 

                                                 $accexistresult = mysqli_query($dbh, $accexist)or die(mysqli_error($dbh));
                                                 //execute SQL statement 

                                                    $accexistrows = mysqli_num_rows($accexistresult); 
                                                    // get number of rows returned 

                                                if($accexistrows){

                                                    while($row = mysqli_fetch_array($accexistresult)){
                                                        $results["accexist"] = $row;

                                                    }
                                                }

                                                $emailexist = $results["accexist"]["email"];

if(isset($_POST['submit']) AND $emailexist == ""){
$email = strtoupper($_POST['email']);
$expansion = "7";
$bnetindex = "1";
$acclock = "1";
$accunlock = "0";

// Battlenet Password
$bnetpassword = strtoupper(bin2hex(strrev(hex2bin(strtoupper(hash("sha256",strtoupper(hash("sha256", strtoupper($email)).":".strtoupper($_POST['pass']))))))));

// Queries
if($insbnet = 'INSERT INTO battlenet_accounts (email, sha_pass_hash, locked) VALUES ("'.$email.'", "'.$bnetpassword.'", "'.$acclock.'");'){


    $insbnetresult = mysqli_query($dbh, $insbnet);





                                                $getaccid = 'SELECT * FROM battlenet_accounts WHERE email = "'.$email.'"'; 
                                                //SQL select query 

                                                 $getaccidresult = mysqli_query($dbh, $getaccid)or die(mysqli_error($dbh));
                                                 //execute SQL statement 

                                                    $getaccidrows = mysqli_num_rows($getaccidresult); 
                                                    // get number of rows returned 

                                                if($getaccidrows){

                                                    while($row = mysqli_fetch_array($getaccidresult)){
                                                        $results["id"] = $row;

                                                    }
                                                }
                                                        $id = $results["id"]["id"];
                                                        $bnetacc = $id;
                                                        $username = $bnetacc."#".$bnetindex;
                                                        $accpassword = encryptpw($username, $_POST['pass']);    

    if($insacc = 'INSERT INTO account (username, sha_pass_hash, email, expansion, battlenet_account, battlenet_index, activation_code) VALUES ("'.$username.'", "'.$accpassword.'", "'.$email.'", "'.$expansion.'", "'.$bnetacc.'", "'.$bnetindex.'", "'.$regcode.'")'){


                                                 $insaccresult = mysqli_query($dbh, $insacc) or die(mysqli_error($dbh));
                                                 //execute SQL statement

        $results = array();                                     

        $success = '<h3 style="color: green;" align="center">Your Account: <span style="color: white;">' . strtolower($email) . '</span> 
        was created successfully! An email was sent to you with informations on how to activate it.</h3>';

        //start the mail() setup
        $password = $_POST['pass'];
        $youremail = 'noreply@shadowmelt.com';
        $subject = 'ShadowMelt Register Confirm';
        $message = '<html><head>';
        $message .= '</head><body>';
        $message .= '<p align="left">Greetings,</p>';
        $message .= '<p align="left">You are receiving this email because you register on our Website platform with this email <b>( ' . strtolower($email) . ' )</b>. If you not did this action, please delete this message.</p>';
        $message .= '<p align="left">Next, it follows the data for you to Login in-game, however you need to activate your account to be able to play. To activate your Account, please click on next link or copy paste on your browser:</p>';
        $message .= '<p align="center"><a style="
            -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
            -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
            box-shadow:inset 0px 1px 0px 0px #ffffff;
            background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf));
            background:-moz-linear-gradient(top, #ededed 5%, #dfdfdf 100%);
            background:-webkit-linear-gradient(top, #ededed 5%, #dfdfdf 100%);
            background:-o-linear-gradient(top, #ededed 5%, #dfdfdf 100%);
            background:-ms-linear-gradient(top, #ededed 5%, #dfdfdf 100%);
            background:linear-gradient(to bottom, #ededed 5%, #dfdfdf 100%);
            filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=\'#ededed\', endColorstr=\'#dfdfdf\',GradientType=0);
            background-color:#ededed;
            -moz-border-radius:6px;
            -webkit-border-radius:6px;
            border-radius:6px;
            border:1px solid #dcdcdc;
            display:inline-block;
            cursor:pointer;
            color:#777777;
            font-family:Arial;
            font-size:15px;
            font-weight:bold;
            padding:13px 24px;
            text-decoration:none;
            text-shadow:0px 1px 0px #ffffff;
        " href="https://www.shadowmelt.com/register?confreg=' . $regcode . '">Activate Account</a></p>';
        $message .= '<p align="left"><b>Login:</b> ' . strtolower($email) . ' <br /><b>Password:</b> ' . $password . '</p>';
        $message .= '<p align="left">For more information, how to connect, visit us on our website!</p>';
        $message .= '</body></html>';
        $headers = 'From: ' . $youremail . "\r\n";
        $headers .= 'MIME-Version: 1.0' ."\r\n";
        $headers .= 'Content-Type: text/HTML; charset=utf-8' . "\r\n";

        $sendto = $email;

            mail($sendto, $subject, $message, $headers);


    }else{
        echo "Insert account error...";
    }
    }else{
        echo "Insert baccount error...";
}

}elseif(isset($_POST['submit']) AND $emailexist != ""){

    $accexisterror = '<h3 style="color: red;" align="center">Your Account was not Created! That email <span style="color: white;">'.strtolower($email).'</span> already exists.</h3>';

}
?>
<div class="content">
<div class="container row">
<div id="left-content">


<div class="post_wrap">
                    <div class="news">
                    <br>
                    <br>
                    <br>

                <!-- Main -->
                                    <?php

                                    if(isset($_GET["confreg"]) != ""){

                                                $acclock = "1";
                                                $accunlock = "0";
                                                $confreg = htmlspecialchars($_GET["confreg"]);

                                                $getaccemail = 'SELECT * FROM account WHERE activation_code = "'.$confreg.'"'; 
                                                //SQL select query

                                                 $accemailresult = mysqli_query($dbh,$getaccemail) or die(mysqli_error($dbh));
                                                 //execute SQL statement

                                                    $accemailrows = mysqli_num_rows($accemailresult); 
                                                    // get number of rows returned 



                                                if($accemailrows){     

                                                    while($row = mysqli_fetch_array($accemailresult)){         
                                                        $results["email"] = $row;
                                                    } 
                                                }

                                                $idaccemail = $results["email"]["email"];

                                                $getacccode = 'SELECT * FROM account WHERE email = "'.$idaccemail.'"'; 
                                                //SQL select query 

                                                 $acccoderesult = mysqli_query($dbh,$getacccode);
                                                 //execute SQL statement 

                                                    $acccoderows = mysqli_num_rows($acccoderesult); 
                                                    // get number of rows returned 

                                                if($acccoderows){    

                                                    while($row = mysqli_fetch_array($acccoderesult)){         
                                                        $results["storedcode"] = $row;   

                                                    }
                                                }                                           

                                                $storedcode = $results["storedcode"]["activation_code"];

                                                $getacclock = 'SELECT * FROM battlenet_accounts WHERE email = "'.$idaccemail.'"'; 
                                                //SQL select query 

                                                 $acclockresult = mysqli_query($dbh,$getacclock);
                                                 //execute SQL statement 

                                                    $acclockrows = mysqli_num_rows($acclockresult); 
                                                    // get number of rows returned 

                                                if($acclockrows){    

                                                    while($row = mysqli_fetch_array($acclockresult)){         
                                                        $results["storedlock"] = $row;
                                                    }
                                                }

                                                $storedlock = $results["storedlock"]["locked"];


                                    if(isset($confreg) == $storedcode AND $storedlock == $acclock){

                                                $activacc = 'UPDATE battlenet_accounts SET locked = "'.$accunlock.'" WHERE email = "'.$idaccemail.'"'; 
                                                //SQL select query 

                                                 $activaccresult = mysqli_query($dbh,$activacc);
                                                 //execute SQL statement 


                                        if($activaccresult){

                                            echo '<h3 style="color: green;" align="center">Your Account: <span style="color: white;">' . strtolower($idaccemail) . '
                                            </span> was Activated! <a href="/howtoconnect" style="color: yellow;">How to Connect?</a></h3>';

                                        }else{

                                            echo '<h3 align="center"><span style="color: red;">Your Account: </span><span style="color: white;">' . strtolower($idaccemail) . '
                                            </span> was Not Activated. Something went wrong, please verify if you copy the correct full link, and if you continue receiving 
                                            this error message, please contact us!</h3>';
                                            echo '<script type="text/javascript">alert(" Something went wrong, please verify if you copy the correct full link, and if you continue receiving 
                                            this error message, please contact us!");</script>';

                                        }

                                    }elseif(isset($confreg) == $storedcode AND $storedlock == $accunlock){

                                        echo '<h3 align="center"><b>(i)</b> <i style="color: yellow;">Your account has already been activated.</i></h3>';
                                        echo '<script type="text/javascript">alert("Your account has already been activated.");</script>';

                                    }elseif(isset($confreg) != $storedcode){

                                        echo '<h3 align="center"><b>(i)</b> <i style="color: yellow;">We can not identify this link!</i></h3>';
                                        echo '<script type="text/javascript">alert("We can not identify this link!");</script>';

                                    }else{

                                        echo '<script type="text/javascript">alert("Something was wrong! We do not identify the issue, please contact us.");</script>';

                                    }

                                    }elseif(isset($success)){ 

                                        echo $success;

                                    }elseif(isset($accexisterror)){

                                        echo $accexisterror;

                                    }else{
                                    ?>

                                    <h3 style="font-size:20px;font-weight:bold;text-transform:uppercase;" align="center">Sign-Up for Shadowmelt!</h3>

                                    <hr />
                                    <br />
                                    <br />
                                    <br />

                                    <div style="width: 630px; margin-left: auto; margin-right: auto;"><form style="display: inline;" target="_blank" action=""><input type="hidden" name="shadowmelt" value="1" /><button class="upmenu">ShadowMelt [Legion]</button></form>
                                    <form style="display: inline; margin-left: 20px;" target="_blank" action="http://www.rainandthunder.net/#register"><button class="upmenu">RainAndThunder [Vanilla]</button></form></div>

                                    <br />
                                    <br />
                                    <br />
                                    <hr />

                                    <form action="" method="post" name="reg">
                                        <table style="border-spacing: 30px; border-collapse: separate;" class="form">
                                            <tr>
                                                <td align="right">
                                                    E-mail Address:
                                                </td>
                                                <td align="left">
                                                    <input style="width: 400px; font-size: 16px;" name="email" type="email" maxlength="254" placeholder="Please insert a valid email(1)" required />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right">
                                                    Password:
                                                </td>
                                                <td align="left">
                                                    <input style="width: 400px; font-size: 16px;" name="pass" type="password" maxlength="16" placeholder="Insert a password to use on login" required />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="right">
                                                    Confirm password:
                                                </td>
                                                <td align="left">
                                                    <input style="width: 400px; font-size: 16px;" name="pass2" type="password" maxlength="16" placeholder="Insert again your password" required />
                                                </td>
                                            </tr>
                                            <tr>              
                                                <td></td>
                                                <td align="center">
                                                    <input type="submit" class="sbm" value="Register" name='submit' />
                                                </td>
                                            </tr>
                                        </table>
                                    </form>
                                    <p align="center"><b>&sup1;</b> <i style="color: yellow;">Is required use a valid email, to activate your Account, 
                                    since our system will send you an email with details on how to activate your Account.</i></p>
                                    <?php } ?>

                    </div>
            </div>


</div>
    <div id="right-content">
    <br>
    <img src="images/box.png">
    </div> 

</div>
</div>
<?php include_once("".$_SERVER['DOCUMENT_ROOT']."/footer.php"); ?>

1 个答案:

答案 0 :(得分:1)

您只需添加此不存在的列:

ALTER TABLE account
  ADD activation_code char(64);

该表列仍然丢失,或者您拼写错误,如果有必要,请在创建新列之前检查一下