Blocking Pornographic Words
Hello,
The code below allows the user to add a table to a database, the name of which is chosen by the user. It works great. However, I would like to block the user from adding tables with pornographic names like "sex," "porn," etc. How could I do this?
Thanks in advance,
John
<?php
if (isset($_POST['name']) && !empty($_POST['name'])) {
mysql_connect("mysqlv3", "username", "database") or
die(mysql_error());
mysql_select_db("sand2") or die(mysql_error());
$table = mysql_real_escape_string($_POST['name']);
$query = "CREATE TABLE `$table` (id INT(11) NOT NULL auto_increment, site VARCHAR(150) NOT NULL, votes_up BIGINT(9) NOT NULL, votes_down BIGINT(9) NOT NULL, PRIMARY KEY(id), UNIQUE (site))";
$result = mysql_query($query) or die(mysql_error());
}
?>
