)(.*?)(?=<\/div>)/', $message, $matches);
$code = ($matches[0]);
preg_match('/(?<=ADi<\/div> <\/td>
)(.*?)(?=<\/div>)/', $message, $matches);
$name = str_replace("=",'%',$matches[0]);
$name = str_replace("%\s",'',$name);
$name = urldecode($name);
preg_match('/(?<=tho=E1=BA=A1i ng=C6=B0= =E1=BB=9Di g=E1=BB=ADi<\/div> <\/td> )(.*?)(?=<\/div>)/', $message, $matches);
$phone = str_replace("=",'%',$matches[1]);
preg_match('/(?<=gian<\/div> <\/td> )(.*?)(?=<\/div>)/', $message, $matches);
$time = str_replace("=",'%',$matches[1]);
preg_match('/(?<=L=E1=BB=9Di nh=E1=BA=AFn<\/div> <\/td> )(.*?)(?=<\/div>)/', $message, $matches);
$content = str_replace(' ','',urldecode(str_replace("=",'%',$matches[1])));
$date = date("d F, Y", strtotime($overview[0]->date));
//Xử lý giao dịch
if ($content != '')
{
$check_code = $conn->query("SELECT * FROM momo WHERE tranId = '$code' ");
$check_username = $conn->query("SELECT * FROM users WHERE username = '$content' ");
if(mysqli_fetch_assoc($check_username) != 0)
{
if(mysqli_fetch_assoc($check_code) == 0)
{
$money = str_replace('.', '', $money);
$create = $conn->query("INSERT INTO momo SET
tranId = '$code',
username = '$content',
comment = '$content',
time = '$time',
partnerId = '$phone',
amount = '$money',
partnerName = '$name' ");
if ($create)
{
$conn->query("INSERT INTO `log` SET
`content`= '+ ".format_cash($money)." lý do: Nạp MOMO Auto #".$code." ',
`createdate` = now(),
`username`= '".$content."' ");
$conn->query("UPDATE users SET
`money` = `money` + '".$money."',
`total_nap` = `total_nap` + '".$money."' WHERE `username` = '".$content."' ");
}
}
}
}
}
}
imap_close($connection);
}
?> | | | |