<?php
include('init.php');

if (empty($_POST)) {
	header('Location: index.php');
	die();
}
include 'templates/header.php';

$id = null;
$cpt = 0;
foreach ($_POST as $name => $value) {
	$cpt;
	if ($name == 'fid') {
		$id = $value;
		continue;
	}
	if (isset($id)) {
		$value = trim(strtolower($value));
		$db->addWord($id, $value);
	}
	if ($cpt > 9) {
		break;
	}
}
echo sprintf('<h3>%s</h3>', L::save_success);

include 'templates/footer.php';