simpleWordsCloud/save.php

35 lines
705 B
PHP
Raw Permalink 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
2020-11-25 22:13:59 +01:00
if (!isset($_POST['fid'])) {
echo sprintf('<h3>%s</h3>', L::save_missingId);
} elseif (!$db->loadCloud($_POST['fid'])) {
echo sprintf('<h3>%s</h3>', L::save_cloudNotFound($_POST['fid']));
} else {
$cpt = 0;
$already_used = array();
foreach ($_POST as $name => $value) {
if ($name == 'fid') {
continue;
}
$cpt++;
if (!in_array($value, $already_used)) {
$already_used[] = $value;
$value = trim(strtolower($value));
$db->addWord($value);
}
if ($cpt > 9) {
break;
}
2020-11-23 11:01:37 +01:00
}
2020-11-25 22:13:59 +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';