1
0
Fork 0
This repository has been archived on 2024-06-28. You can view files and clone it, but cannot push or open issues or pull requests.
Rechtschreibung/main.php

56 lines
1.2 KiB
PHP
Raw Normal View History

2014-07-01 09:53:36 +02:00
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<title>haupt</title>
</head>
<body>
<?php
$falscheswort ="langes wort";
if(isset($_GET["wort"])) {
$falscheswort =$_GET["wort"];
}
2014-07-01 10:34:27 +02:00
$tabellen = array();
if(isset($_GET["ul-de"])) {
$tabellen[] = "unileipzig-de";
}
if(isset($_GET["ul-en"])) {
$tabellen[] = "unileipzig-en";
}
if(isset($_GET["nm"])) {
$tabellen[] = "netzmafia";
}
2014-07-01 09:53:36 +02:00
require_once 'verbindungsaufbau.php';
2014-07-01 10:34:27 +02:00
foreach ($tabellen as $tabelle) {
$vorhanden = $mysqli->query("SELECT id FROM `$tabelle` WHERE wort='$falscheswort'");
if($vorhanden->num_rows == 1) {
echo "<p><strong>Das Wort ist richtig</strong></p>";
exit;
}
$vorhanden->close();
2014-07-01 09:53:36 +02:00
}
$arrayahnlich =array(); // leeres Array erstellen
2014-07-01 10:34:27 +02:00
foreach ($tabellen as $tabelle) {
$ergebnis = $mysqli->query("SELECT wort FROM `$tabelle`");
// echo "<table border='1'>\n";
while ($wort = $ergebnis->fetch_array()) {
$ahnlichkeit=similar_text($falscheswort, $wort[0]);
// echo "<tr><td>$wort[0]</td><td>$ahnlichkeit</td></tr>";
$arrayahnlich[$wort[0]] = $ahnlichkeit;
}
$ergebnis->close();
// echo "</table>";
2014-07-01 09:53:36 +02:00
}
asort($arrayahnlich);
$top = array_keys($arrayahnlich);
echo "$top[0],$top[1],$top[2],$top[3]";
2014-07-01 10:34:27 +02:00
print_r($top);
2014-07-01 09:53:36 +02:00
?>
</table>
</body>
</html>