Hi,
Can any one tell me how to run a comparison on information from a database using the strstr() function. When I get the result back from my database it works fine unless I try to run the check on the entire array of information. What I am trying to do is write a simple script that will do a top level domain check to ban hostile users. Here is the code I have so far....
$link = mysql_connect( $host, $user, $pass );
if ( ! $link )
die( "Could not open MySQL Connection");
if ( isset( $REMOTE_HOST ) ){
mysql_select_db( $db, $link )
or die( "Could Not open $db: ".mysql_error() );
$result = mysql_query("SELECT hostname FROM tablename");
$ipdata = mysql_fetch_array( $result );
foreach ( $ipdata as $val )
{
if ( strstr( $REMOTE_HOST, $val) ){
die("Your Host has been banned from Our Server");
}
else {
header( "Location:page.htm" );
}
}
mysql_close( $link );
}