simpleWordsCloud/save.php

31 lines
532 B
PHP
Raw Normal View History

2020-11-15 21:51:28 +01:00
<?php
2020-11-23 11:01:37 +01:00
include('init.php');
2020-11-15 21:51:28 +01:00
if (empty($_POST)) {
header('Location: index.php');
die();
}
2020-11-23 11:01:37 +01:00
include 'templates/header.php';
2020-11-15 21:51:28 +01:00
$id = null;
2020-11-23 11:01:37 +01:00
$cpt = 0;
$already_used = array();
2020-11-15 21:51:28 +01:00
foreach ($_POST as $name => $value) {
2020-11-23 11:01:37 +01:00
$cpt;
2020-11-15 21:51:28 +01:00
if ($name == 'fid') {
$id = $value;
continue;
}
if (isset($id) && !in_array($value, $already_used)) {
$already_used[] = $value;
2020-11-15 21:51:28 +01:00
$value = trim(strtolower($value));
$db->addWord($id, $value);
}
2020-11-23 11:01:37 +01:00
if ($cpt > 9) {
break;
}
2020-11-15 21:51:28 +01:00
}
2020-11-23 11:01:37 +01:00
echo sprintf('<h3>%s</h3>', L::save_success);
2020-11-15 21:51:28 +01:00
2020-11-23 11:01:37 +01:00
include 'templates/footer.php';