simpleWordsCloud/save.php

31 lines
532 B
PHP

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