A fatal MySQL error occured.\n
Query: " . $q . "
\nError: (" . mysql_errno() . ") " . mysql_error());
$mylistofunbanned = "
domain | cnt |
" ;
$cnt=0;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$mylistofunbanned .= "" . substr($line[domain],0,35) . " | " . $line[count] . " |
\n" ;
$cnt++;
}
$mylistofunbanned .= "
" ;
include'_close_db.php';
return $mylistofunbanned ;
} /* END OF showListOfUnBanned () */
$mylist = showListOfUnBanned () ;
function insertDomain($mylist){
if($_POST['domain']) {
extract($_POST);
if (strpos($mylist, $domain) || $domain == " " ) {
echo "We found "$domain" in domain-list at position $pos2";
}
if(!$domain ) {
print"DOMAIN field must be filled out
";
} else {
include'_conn_db.php';
$qInsert=" INSERT INTO unbannedsites(domain,myclass,comment) ";
$qValues=" VALUES('$domain', '$myclass', '$comment') ";
$q=$qInsert.$qValues;
($result = @mysql_query ( $q , $connection))
or die("A fatal MySQL error occured.\n
Query: " . $q . "
\nError: (" . mysql_errno() . ") " . mysql_error());
include'_close_db.php';
}
}
}
function updateUnBannedSites_address() {
$link = mysql_connect("localhost", "root", "")
or die("Could not connect : " . mysql_error());
mysql_select_db("firewall") or die("Could not select database");
$sql_maxid = mysql_query("select max(bannedsites_id) from unbannedsites_address2") or die("MaxID query failed : " . mysql_error());
while ($maxid = mysql_fetch_array($sql_maxid, MYSQL_NUM)) {
$max_id = $maxid[0] ;
}
$query = "SELECT id, domain FROM unbannedsites WHERE id>$max_id AND domain IS NOT NULL GROUP BY domain ";
$result = mysql_query($query) or die("Query failed : " . mysql_error());
while ($line = mysql_fetch_array($result, MYSQL_NUM)) {
$zzz=gethostbynamel(trim($line[1]));
if ($zzz){
foreach ($zzz as $zzzz) {
$q = "INSERT INTO unbannedsites_address2(bannedsites_id, address, comment,myshortmask) ";
$q .= "VALUES(\"" . $line[0] . "\",\"" . $zzzz . "\",\"" . $line[1] . "\",24);" ;
$result2 = mysql_query($q) or die("Insert Query failed : " . mysql_error());
echo $zzzz . " " ;
$zzzz_txt.= "$zzzz\n";
}
}
}
// see z_Append_File.php
file_append("addthesetofirewall.txt", $zzzz_txt);
mysql_free_result($result);
mysql_close($link);
} /* END OF updateUnBannedSites_address() */
insertDomain($mylist);
sleep(1);
updateUnBannedSites_address();
if($_GET['submit-address']) {
updateUnBannedSites_address();
}
/* END php BEGIN the HTML */
?>
UN BANNED TOO