gpt4 book ai didi

php - 使用嵌套 while 循环时获取随机空白电子邮件

转载 作者:行者123 更新时间:2023-11-30 00:29:43 24 4
gpt4 key购买 nike

第一,我知道mysql_已经过时了,我应该使用mysqli(不幸的是,我继承了这个系统及其方式,目前需要做太多的工作来改变它)

我遇到的问题是,当我执行代码时,我收到随机的空白电子邮件。该系统循环访问数据库中的商店列表,并在表中为商店经理列出信息。呈现什么信息并不重要。有人立即看到任何可能导致此问题的东西吗?

while($store = mysql_fetch_array($result_store)){

#Updates the Report Date for each store in the Loop
$report_date = "UPDATE ActiveStores SET Report_Date = '$Today' WHERE StoreNumber = $store[StoreNumber]";

if (!mysql_query($report_date, $con)){
die('Error: ' . mysql_error());
}


#Selects data from ActiveStores for the current store in the loop
$result2 = mysql_query("SELECT * FROM ActiveStores WHERE StoreNumber = '$store[StoreNumber]' ORDER BY StoreNumber");

#Loops through the currently selected store and Creates an Array of the data
while ($row = mysql_fetch_array($result2)) {
#Sets Store Variable

$Store = $row['StoreNumber'];
echo '<table width="1110"><table width="1102"><tr>';


# To Email Address

#$emailaddress = '******@*****.com';

# Message Subject
$emailsubject= 'Testing Report - Store: ' . $Store;

#Turn on Output buffer for email
ob_start();
#Heading for Report
echo '<h2 class="blktext">Walgreens Weekly Report - ' . $Today . '<br /></h2>';

echo '<h2>Insurance Orders:</h2>';


#Cancelled Orders for the store this week
$result_cash_canceled = mysql_query("SELECT * FROM Orders WHERE StoreNumber = '$Store' AND Cancel = 'checked' AND Order_Type = 'Cash' AND Cancel_Date > '$Sevendaysback'");
$tot_ord_ins_prt = mysql_num_rows($result_cash_canceled);


if ($tot_ord_ins_prt !== 0){
echo '<h4 class="blktext">Cancelled Orders for the store this week</h4><span class="blktext">';
echo '<p><i>Fitter Action: Fitter to contact client to notify of cancelled order, if not initialed by client.</i></p>';
echo "<table border='4' class='rpttbl' frame='hsides' rules='rows' width='1400'>";
echo '<tr><th>Store #</th><th>Order #</th><th>Customer</th><th>Phone #</th><th>Cancel Date</th width="150"><th>Reason for Cancellation</th><th width = "150">Patient Notified<th></tr>';
while($row_cash_canceled = mysql_fetch_array($result_cash_canceled)){

echo "<tr>";
echo "<td align='center'>" . $row_cash_canceled['StoreNumber'] . "</td>";
echo "<td align='center'>" . $row_cash_canceled['Order_ID'] . "</td>";
echo "<td align='center'>" . $row_cash_canceled['Cust_First_Name'] . " " . $row_bo['Cust_Last_Name'] . "</td>";
echo "<td align='center'>" . $row_cash_canceled['Cust_Phone'] . "</td>";
echo "<td align='center'>" . $row_cash_canceled['Cancel_Date'] . "</td>";
echo "<td align='center'>&nbsp;</td>";
echo "<td align='left'>( ) Called: Patient Cancelled notified<br />( ) Called: LVM for Patient</td>";
echo "</tr>";
}
echo "</table>";
echo "Total: " . $tot_ord_ins_prt;
echo'</span>';
}





#Message at bottom of email
echo '<br /><br /><br /><br /><p>Thank you for your prompt attention to this report.</p>';
echo '<p>If this report is blank in all the above sections, this means, at this point, we are not showing any active orders within our system.<br />';
echo 'If you feel this is in error, please contact our Customer Care team at: <strong>(***) ***-8125</strong></p>';
echo '<p>Please update this form with the appropriate action taken by patient, and fax back to: (866) 8**-**** OR email to: ******@*****.com</p>';
echo '<p>Fitter Name: ________________________________________</p>';
echo '<p>Comments: _______________________________________________________________<br />';
echo '_________________________________________________________________________</p>';
echo '<p>The information contained in this email, together with any attachments, is intended only for the use of the individual or entity<br /> to which it is addressed. It may contain information that is confidential and prohibited from disclosure. If you are not the intended <br />';
echo 'recipient, you are hereby notified that any dissemination, or copying, of this message or any attachment is strictly prohibited.</br> If you have received this message<br /> in error, please notify the original sender immediately by phone or by return email, </br>';
echo 'and delete this email, along with any attachments. <br />Receipt by anyone other than the intended recipient is not</br> a waiver of any privileged information. </p>';

}

$body=ob_get_contents();
ob_end_clean();

#$body = "** It is Imperative that you respond to this email. When you receive this please print it out, sign your name and store number and fax the form to ***-***-1161**<br /><br /><br />";
#$body .= "Name: <br /><br />Store #:";


$headers = 'From: Visual Footcare Technologies *****@****.com'.$eol;
$headers .= 'Reply-To: Visual Footcare Technologies *****@*****.com'.$eol;
$headers .= 'Return-Path: Visual Footcare Technologies <mcooper@visualfootcare.com>'.$eol; // these two to set reply address
#$headers .= 'Cc: ******@*****.com'.$eol;
$headers .= "Message-ID:<".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol;
$headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam-filters

$mime_boundary=md5(time());
$headers .= 'MIME-Version: 1.0'.$eol;
$headers .= "Content-Type: multipart/related; boundary=\"".$mime_boundary."\"".$eol;
$msg = "";


$msg .= "Content-Type: multipart/alternative".$eol;

$msg .= "--".$mime_boundary.$eol;
$msg .= "Content-Type: text/html; charset=iso-8859-1".$eol;
$msg .= "Content-Transfer-Encoding: 8bit".$eol;
$msg .= $body.$eol.$eol;

$msg .= "--".$mime_boundary."--".$eol.$eol; // finish with two eol's for better security. see Injection.

然后是一个标准的 mail(......) 代码来发送电子邮件,然后结束循环。

希望这是有道理的。

最佳答案

尝试改变这个

if ($tot_ord_ins_prt !== 0)

if ($tot_ord_ins_prt !== false)

关于php - 使用嵌套 while 循环时获取随机空白电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22600693/

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