Hi Guys,
I need some help please, i’ve made a script that does a few fraud checks on data submitted through our system (I’m still working on the fraud check script in case some of you think is that the only fraud checks im making). The problem i have is if theres no matches after running the IP Country Check section then the Email Valid Check will not be ran and i dont understand why, if anyone could help me that would be great please.
<?php
require("./databaseconnection.php"); //Get Database Login Information
//Do IP Country Check
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Oops theres an error, our highly trained monkeys have been notified.");
$query = "SELECT * FROM `leads` WHERE `CountryCheck` = 'NO'";
$result=mysql_query($query);
$num=mysql_numrows($result) or die(mysql_error());
$i=0;
while ($i < $num) {
while($row = mysql_fetch_array($result))
{
$ipcountry=$row['IPCountry'];
$ipcc=$row['IPCC'];
$ipisp=$row['IPISP'];
$leadid=$row['LeadID'];
$ProgramID=$row['ProgramID'];
//Get Country Of Each Lead
$query2 = "SELECT * FROM `programs` WHERE `ID` = '$ProgramID'";
$result2=mysql_query($query2);
while($row = mysql_fetch_array($result2))
{
$programcountry=$row['Country'];
}
//End
if ( $ipcc == $programcountry ) {
$query3 = "UPDATE leads SET CountryCheck='PASS' WHERE LeadID='$leadid'";
mysql_query($query3);
} else {
$query3 = "UPDATE leads SET CountryCheck='FAIL' WHERE LeadID='$leadid'";
mysql_query($query3);
}
}
$i++;
}
mysql_close();
//End
echo "Finished Country Check! <br />";
//Do Email Valid Check
include("./emailcheck.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Oops theres an error, our highly trained monkeys have been notified.");
$query = "SELECT * FROM `leads` WHERE `EmailCheck` = 'NO'";
$result=mysql_query($query);
$num=mysql_numrows($result) or die(mysql_error());
$i=0;
while ($i < $num) {
while($row = mysql_fetch_array($result))
{
$emailaddress=$row['EmailAddress'];
$leadid=$row['LeadID'];
$bIsEmailValid = jValidateEmailUsingSMTP("$emailaddress", "REMOVED.com", "fraudcheck@REMOVED.com");
$emailchecker = $bIsEmailValid ? "Valid" : "Invalid";
if ($emailchecker=="Valid")
{
$query3 = "UPDATE leads SET EmailCheck='PASS' WHERE LeadID='$leadid'";
mysql_query($query3);
}
else
{
$query3 = "UPDATE leads SET EmailCheck='FAIL' WHERE LeadID='$leadid'";
mysql_query($query3);
}
}
$i++;
}
mysql_close();
//End
echo "Finished Email Check!";
?>
Any help wouldbe great, thank you in advance!