Example #1
0
<?php 
include_once "libPalabras.php";
include $_SERVER['DOCUMENT_ROOT'] . 'KhunluungramnerkP/loginMySQL.php';
$handler = new WordHandler('localhost', 'khunluungramnerk', $usrDB["user"], $usrDB["passwd"]);
$handler->conn();
if (!isset($_SESSION["usr"])) {
    header('Location: index.php');
}
if (isset($_POST["crear"])) {
    $crearReforma = array("tipo" => "INSERT", "campos" => array("id" => $handler->getMaxTabla("id", "cte_reformas"), "acrónimo" => $_POST["acrónimo"], "nombre" => $_POST["nombre"], "descripción" => $_POST["descripción"], "fecha" => date("Y:m:d")), "tabla" => "cte_reformas");
    $handler->query($crearReforma);
} elseif (isset($_POST["ref_id"])) {
    foreach ($_POST as $clave => $campo) {
        $str = new String($clave);
        if ($str->startsWith("af_")) {
            $str->remove_prefix("af_");
            $num = $str->get();
            $handler->setWordID($_POST["pal_id_" . $num]);
            $handler->getDatosPalabra();
            $handler->reformarPalabra($_POST["pal_" . $num], $_POST["ref_id"]);
        }
    }
}
$handler->shutdown();
session_start();
header('Location: ' . $_SESSION["urlVuelta"]);