/**
 * Bases de datos - agenda.php
 *
 * @author    Joan Piera Simó
 * @copyright 2016 Joan Piera Simó
 * @license   http://www.gnu.org/licenses/agpl.txt AGPL 3 or later
 * @version   2016-02-05
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once "agenda.php";
if (!isset($_REQUEST["si"])) {
    header("Location:index.php");
    exit;
} else {
    $db = conectaDb();
    sinCabecera("Crear Agenda", MENU_VOLVER);
    creaDB($db);
    $db = null;
    pie();
}
Esempio n. 2
0
<?php

include 'utility.php';
#creaDB()
#connessione/creazione db
if ($_POST['creaDB']) {
    $link = mysql_connect('localhost', 'root', 'MySQL', '8080');
    if (!$link) {
        if (creaDB()) {
            die('Ci sono dei problemi con la creazione del Database' . mysql_errno());
        }
    }
    echo 'Connected successfully';
} else {
    $pieces = explode(' ', $_POST['query']);
    if ($pieces == false or strcmp($pieces[0], "insert") !== 0 or strcmp($pieces[1], "into") !== 0) {
        die('La query richiesta non è corretta. Vengono accettate solo quelle di inserimento!');
    } else {
        $res = mysql_query($_POST['query']);
        if (!$res) {
            die("Errore nell'esecuzione della query: " . mysql_errno());
        }
    }
}