Avoid multiple insertion
Avoid multiple insertion of the same word on the same vote
This commit is contained in:
parent
844ca51a49
commit
ce1f76a96c
1 changed files with 3 additions and 1 deletions
4
save.php
4
save.php
|
@ -9,13 +9,15 @@ include 'templates/header.php';
|
|||
|
||||
$id = null;
|
||||
$cpt = 0;
|
||||
$already_used = array();
|
||||
foreach ($_POST as $name => $value) {
|
||||
$cpt;
|
||||
if ($name == 'fid') {
|
||||
$id = $value;
|
||||
continue;
|
||||
}
|
||||
if (isset($id)) {
|
||||
if (isset($id) && !in_array($value, $already_used)) {
|
||||
$already_used[] = $value;
|
||||
$value = trim(strtolower($value));
|
||||
$db->addWord($id, $value);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue