This code works but only once, when it returns FAIL it doesn't return fail again even though it should, however; it does keep running the first part returning ICMP, TCP and UDP IP's....Is it that the MySQL connection is broken? Any help appreciated. Thanks!
if ( bShowTCP )
{
printf("\n -------------------- // -------------------- ");
printf("\n TCP Header:");
int *addressValue = new int();
char *address = LIP;
inet_pton(AF_INET, address, addressValue);
if (ip_header->source_ip == *addressValue)
{
printf("\n Source IP: %s", "0.0.0.0");
printf("\n Destination IP: %s", ipDest);
}
else
{
printf("\n Source IP: %s", ipSrc);
printf("\n Destination IP: %s", ipDest);
if (mysql_real_connect(conn,"urlock.db.5513143.hostedresource.com","VendorCheck","Reader1234","urlock",0,NULL,0) !=0)
{
(mysql_query(conn,"SELECT COUNT(*) FROM tblURLIP WHERE IP = inet_aton('ipSrc') And IPStatus = '1' And IPMax = '0'"));
my_ulonglong i = 0;
res_set = mysql_store_result(conn);
my_ulonglong numrows = mysql_num_rows(res_set);
LEGIT = mysql_fetch_row(res_set);
if (atoi(LEGIT[i]) == 1)
{
printf("\n PASS: %s\n",LEGIT[i]);
(mysql_query(conn,"INSERT INTO tblIPAccess (IP , Dwnload) VALUES(inet_aton('ipSrc'), '1')"));
(mysql_query(conn,"SELECT COUNT(*) FROM tblURLAccess WHERE IP = inet_aton('ipSrc') And Dwnload = '1'"));
my_ulonglong g = 0;
res_set = mysql_store_result(conn);
my_ulonglong numrows = mysql_num_rows(res_set);
TTL = mysql_fetch_row(res_set);
(mysql_query(conn,"SELECT (IPQuota) FROM tblURLIP WHERE IP = inet_aton('ipSrc') And IPStatus = '1'"));
my_ulonglong h = 0;
res_set = mysql_store_result(conn);
MX = mysql_fetch_row(res_set);
if ((atoi(TTL[g])) < (atoi(MX[h])))
{
(mysql_query(conn,"UPDATE tblURLIP SET IPMax '1' WHERE IP = inet_aton('ipSrc')"));
mysql_close(conn);
}
}
else
{
printf("\n FAIL: %s\n",LEGIT[i]);
}
}
}
}
break;