simpleWordsCloud/save.php

35 lines
705 B
PHP

<?php
include('init.php');
if (empty($_POST)) {
header('Location: index.php');
die();
}
include 'templates/header.php';
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;
}
}
echo sprintf('<h3>%s</h3>', L::save_success);
}
include 'templates/footer.php';