gpt4 book ai didi

php - 确认电子邮件未从 php 和 mysql 数据发送?

转载 作者:行者123 更新时间:2023-11-29 18:03:37 25 4
gpt4 key购买 nike

所以我有一个表格,您可以在其中要求某人通过电子邮件加入您的小组,但由于某种原因它没有发送电子邮件,昨天工作得很好,现在似乎有些问题了。这是形式:

<div class="form" style="background: white; box-shadow: 0 0px rgba(0, 0, 0, 0);">
<form id="addmember" action="addingmember.php" method="post" autocomplete="off">
<div class="field-wrap">
<label style="position: relative; color: black;">
Member Email:
</label>
<input type="email" required autocomplete="off" name="memberemail"
style="color: black; padding: 8px; height: 48px;"/>
</div>
<button type="submit" class="button button-block" name="submit">
Submit
</button>
</form>

这是添加成员代码:

<?php

include '../db_connection.php';

session_start();

$leaguename = $_SESSION['league_name'];
$startdate = $_SESSION['start_date'];
$enddate = $_SESSION['end_date'];
$joincode = $_SESSION['joincode'];

$_SESSION['memberemail'] = $_POST['memberemail'];

$memberemail = $link->escape_string($_POST['memberemail']);

//check member Email matches
$memberemail = $link->query("SELECT Email FROM logins WHERE Email =' " . $_SESSION['memberemail'] . "'")->fetch_assoc()['memberemail'];

$to = $memberemail;
$subject = "Becoming part of $leaguename";
$body .= "So you want to become part of $leaguename?" . PHP_EOL;
$body .= "Please click the link below to join!" . PHP_EOL;
$body .= "http://www.linkhere.com/login/verify.php?memberemail=$memberemail&joincode=$joincode;" . PHP_EOL;

$headers = "From: emailhere";

mail($to, $subject, $body, $headers);
//header("location: addanothermember.php");

?>

最佳答案

$memberemail = $link->query("SELECT Email FROM logins WHERE Email =' " . $_SESSION['memberemail'] . "'")->fetch_assoc()['memberemail'];

您基本上在查询中选择“电子邮件”,但想从中获取“memberemail”。也许这就是问题所在。

添加对 $memberemail 变量的检查。

此外,在查询中使用 $_SESSION['memberemail'] 而不转义它有点危险。

关于php - 确认电子邮件未从 php 和 mysql 数据发送?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48111623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com