Compare commits

..

No commits in common. "39d4be9eb33e13cef7c2f5d825ac0a210feb0319" and "844ca51a49f1ca6902a3f5e3c792ea5bbf8f4caf" have entirely different histories.

2 changed files with 1 additions and 25 deletions

22
db.php
View file

@ -85,19 +85,6 @@ class DataBase
} else { } else {
return false; return false;
} }
$stmt = $this->db->prepare("
SELECT *
FROM words
WHERE cloud_id = :cid;
");
$stmt->bindValue(':cid', $cloudId, PDO::PARAM_INT);
$stmt->execute();
while($data = $stmt->fetch()) {
if ($this->areWordsSimilar($data['word'], $word)) {
$word = $data['word'];
break;
}
}
$stmt = $this->db->prepare(" $stmt = $this->db->prepare("
SELECT * SELECT *
FROM words FROM words
@ -288,13 +275,4 @@ class DataBase
return false; return false;
} }
function areWordsSimilar(string $word1, string $word2)
{
$sim = similar_text($word1, $word2, $perc);
$sim_meta = similar_text(metaphone($word1), metaphone($word2), $perc_meta);
if ($perc >= 80 && $perc_meta >= 80) {
return true;
}
return false;
}
} }

View file

@ -9,15 +9,13 @@ include 'templates/header.php';
$id = null; $id = null;
$cpt = 0; $cpt = 0;
$already_used = array();
foreach ($_POST as $name => $value) { foreach ($_POST as $name => $value) {
$cpt; $cpt;
if ($name == 'fid') { if ($name == 'fid') {
$id = $value; $id = $value;
continue; continue;
} }
if (isset($id) && !in_array($value, $already_used)) { if (isset($id)) {
$already_used[] = $value;
$value = trim(strtolower($value)); $value = trim(strtolower($value));
$db->addWord($id, $value); $db->addWord($id, $value);
} }