如何检测同一电子邮件是否在 2 分钟内出现多次。
这是我的输出:
07-02-13 20:08:41 test11@gmail.com
07-02-13 20:09:41 test11@gmail.com
07-02-13 20:21:25 hottie@gmail.com
07-02-13 20:56:51 ugly@gmail.com
07-02-13 21:42:37 selma532@gmail.com
07-02-13 22:09:11 blalbla421@gmail.com
这是我的 SQL 语句。
$results = $this->EE->db->query("SELECT t.* FROM transactions as t WHERE t.cardid > 0 ORDER BY t.created DESC");
我要他们分开她。因此,如果相同的邮件在 2 分钟内出现,则必须进行不良交易。
foreach ($results->result_array() as $filter)
{
我可以帮忙:我有一个 $filter['created'] = 这包含时间,我有一个 $filter['email'] )这包含电子邮件。
if(//Filter goes here) {
$badtransactions[]=$filter;
} else {
$cooltransactions[]=$filter;
}
这是我的
<table class="table">
<h3>Cool Transactions (<?php print_r($sizeCoolTransactions)?>) </h3>
<thead>
<tr>
<th>Time</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<?php
//Foreach over cooltransactions
foreach($cooltransactions as $transaction) {
// IS NEW?
$isactive = false;
if($transaction['created'] > time()-$refresh_timer){
$isactive = true;
}
// Get user mail.
$member_sql = $this->EE->db->query("SELECT email FROM exp_members WHERE member_id = '".($transaction['cardid']-10000000)."'");
$member_result = $member_sql->result_array();
if(isset($member_result[0])) {
$member_result1 = $member_result[0];
}
?>
<tr class="<?= $isactive ? 'alert-success' : ''; ?>">
<td><?= date('d-m-y H:i:s', $transaction['created']); ?></td>
<td><?= isset($member_result1['email']) ? $member_result1['email'] : '<span style="color:red">Email mangler</span>'; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>