How can I detect if the same email appears more than once within 2 minuts.
This is my OutPut:
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
This is my SQL statement.
$results = $this->EE->db->query("SELECT t.* FROM transactions as t WHERE t.cardid > 0 ORDER BY t.created DESC");
I want them to seperate her. So if the same mail appears withing 2 minuts it has to go to bad transactions.
foreach ($results->result_array() as $filter)
{
I can help with this: I have a $filter['created'] = This contains time and i have a $filter['email'] ) this contains emails.
if(//Filter goes here) {
$badtransactions[]=$filter;
} else {
$cooltransactions[]=$filter;
}
This is my
<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>