Could not connect to database: ."; exit; }
mysql_select_db($dbname);
mysql_query("SET NAMES 'utf8'", $conn);
mysql_query("SET CHARACTER SET 'utf8'",$conn);
$command="select * from testtable where match (textfield) AGAINST ('+".$q."' IN BOOLEAN MODE) ";
//if $q does not contains a valid utf8 string mysql will hang with 100% CPU forever, tested in mysql version 4.1.10
echo $command;
$result =mysql_query($command);
$num =mysql_num_rows($result);
echo "
$num rows selected";
?>
This url works:
http://localhost/crash.php?q=word
This url wil crash MySQL with 100% CPU:
http://localhost/crash.php?q=espa%F1ol
or depending on your current system locale:
http://localhost/crash.php?q=espaņol