这就是我希望它在数据库中找到有关电子邮件查找的方法,如果它出现并打招呼,此电子邮件正忙于尝试不同或类似的。
我希望: 它来了解我的数据库中找到的电子邮件,如果它确实必须给用户一个答案。
如果数据库中不存在,则只是正常创建用户。
现在把它变为0,数据库中没有电子邮件或者看起来像但是它仍然说电子邮件已注册,但如果我输入1代替0,那么我可以创建尽可能多的电子邮件。/ p>
}
else
{
$email_1 = $_post["email"];
$result = $this->mysqli->query("SELECT * FROM `bruger` WHERE email='$email_1'");
if(mysqli_num_rows($resut) > 0)
{
$pb = null;
include "fun_filer/img/class.upload.php";
$handle = new Upload($_FILES["file"]);
if($handle->uploaded)
{
$handle->image_resize = true;
$handle->image_ratio_crop = true;
$handle->image_y = 75;
$handle->image_x = 75;
$handle->Process("images/bruger");
$pb = $handle->file_dst_name;
}
if($stmt = $this->mysqli->prepare("INSERT INTO `bruger` (`rank`, `email`, `adgangskode`, `navn`, `efternavn`, `profil_img`) VALUES (?, ?, ?, ?, ?, ?)"))
{
$stmt->bind_param('isssss', $rank, $email, $adgangskode, $navn, $efternavn, $profil_img);
$rank = 1;
$email = $_POST["email"];
$adgangskode = sha1($_POST["password_adgangskode_1"]);
$navn = $_POST["fornavn"];
$efternavn = $_POST["efternavn"];
$profil_img = $pb;
$stmt->execute();
$navn = $_POST["navn"];
$til = $_POST["email"];
$password = $_POST["password_adgangskode_1"];
$fra = "Hello.com - Opret bruger <" . "info@hello.com" . ">";
$til = $_POST["email"];
$emne = "Velkommen til Hello.com";
$besked = file_get_contents('mail_opret.php');
$besked = str_replace("%%navn", $navn, $besked);
$besked = str_replace("%%brugernavn", $til, $besked);
$besked = str_replace("%%password", $password, $besked);
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=UTF-8 \n";
$headers .= "From: " . $fra . "\n";
mail($til, $emne, $besked, $headers);
?>
<div class="article-main-content">
<div class="alert-message" style="background-color:#77b01e;"><span class="icon-text">✓</span><span class="alert-content">Din bruger er blevet opret og du få en email fra os <a href="#" class="destroy-button"></a></div>
</div>
<?php
$stmt->close();
}
else
{
echo 'Der opstod en fejl i erklæringen: ' . $this->mysqli->error;
}
}
else
{
?>
<div class="article-main-content">
<div class="alert-message" style="background-color:#c22525;"><span class="icon-text">⚠</span><span class="alert-content">Email Findes på hjemmesiden</span><a href="#" class="destroy-button"></a></div>
</div>
<?php
}
}
}
当我将它定位于1时,输入和所有内容都非常好。
答案 0 :(得分:0)
我建议在Sql表中使用唯一键。但是,你写'resut'只是一个错误吗?