I'm having a problem putting entries into a table.
I have a job board and I want to prevent certain companies from being able to register - again. I don't allow certain type ads, so when they register the first time and I delete them they just re-register and this process goes on and on and on.
I put a piece of code into the registration form that checks to see if if this company is in a list and if so a message is returned saying "registrati on denied". Only problem with this is that I have to open the page and hard code the company name into the script.
What these people will do is to change the name slightly and they're allowed to re-register, for instance: Company name: Redstar, Company name: RedStar, Company name: Red-star, Company name: Red-Star, and on and on and on.
Here's what I have right now:
So what I'm trying to do now is to build a "banned names" database that when the registration page is submitted the first this it does it check to see if the $company_name matches a name on file in the "banned names" table. If so the registration stops and a registration denied message is delivered.
The problem is that MySQL isn't allowing different versions of the same name to be entered. See the different variations of the same name above where a different letter in the company name will be capitalized? When I try to enter in a different variation of the same name I get this message:
Here's my add banned name script:
I have no unique keys set for the banned names table.
Thanks
I have a job board and I want to prevent certain companies from being able to register - again. I don't allow certain type ads, so when they register the first time and I delete them they just re-register and this process goes on and on and on.
I put a piece of code into the registration form that checks to see if if this company is in a list and if so a message is returned saying "registrati on denied". Only problem with this is that I have to open the page and hard code the company name into the script.
What these people will do is to change the name slightly and they're allowed to re-register, for instance: Company name: Redstar, Company name: RedStar, Company name: Red-star, Company name: Red-Star, and on and on and on.
Here's what I have right now:
Code:
$cn = $company_name;
if ($cn == 'REDSTAR' OR $cn == 'Redstar' OR $cn == 'RedStar' OR $cn == 'Red-star' OR $cn == 'Red-Star' OR $cn == 'Spectrum' OR $cn == 'Pre Paid Legal Services Inc' OR $cn == 'Typeinternational' OR $cn == 'Ozwebresources' OR $cn == 'HOME WORK' OR $cn == 'Advantage Marketing' OR $cn == 'Moms Work Smarter' OR $cn == 'Satisfaction Services' OR $cn == 'Ameriplan' OR $cn == 'ozwebresources' OR $cn == 'OzWebresources' OR $cn == 'OzWebResources' OR $cn == 'ozwebResources' OR $cn == 'Grindhouse Associate' OR $cn == 'John H Maxson')
{
echo "Registration Denied";
footer();
exit();
}
else
{ // continue with registration
The problem is that MySQL isn't allowing different versions of the same name to be entered. See the different variations of the same name above where a different letter in the company name will be capitalized? When I try to enter in a different variation of the same name I get this message:
Code:
The banned name could not be updated due to a system error.
Duplicate entry '' for key 2
Query: INSERT INTO banned VALUES ('', 'Redstar', '')
Code:
if (isset($_POST['submitted']))
{ // Handle the form.
$b_name = escape_data($_POST['b_name']);
$b_email = escape_data($_POST['b_email']);
$query = "INSERT INTO banned VALUES ('', '$b_name', '$b_email')";
$result = mysql_query($query);
if (mysql_affected_rows() == 1) { // If it ran OK.
// Print a message.
echo "<p>The banned name has been entered.</p>";
} else { // If it did not run OK.
echo "<h2>System Error</h2>
<p>The banned name could not be added due to a system error.</p>"; // Public message.
echo "<p>" . mysql_error() . "<br><br>
<strong>Query:</strong> " . $query . "</p>"; // Debugging message.
footer(); // Include the HTML footer.
exit();
mysql_close();
}
Thanks
Comment