Example #1
0
function guardarPregunta()
{
    $idtema = $_POST['IdTema'];
    $contenido = $_POST['Contenido'];
    $respuesta = $_POST['Respuesta'];
    $valor = $_POST['Valor'];
    $tipo = $_POST['Tipo'];
    //crea el objeto pregunta
    $preg = new Pregunta();
    $preg->crearPregunta($idtema, $contenido, $respuesta, $tipo, $valor);
    //ejecuta la funcion en PreguntaData que inserta una pregunta
    insertarPregunta($preg);
}
Example #2
0
<?php

switch ($_GET['f']) {
    case "insertarPregunta":
        echo insertarPregunta($_GET['email'], $_GET['pregunta'], $_GET['respuesta'], $_GET['complejidad']);
        break;
    case "modificarPregunta":
        echo modificarPregunta($_GET['id'], $_GET['pregunta'], $_GET['respuesta'], $_GET['complejidad']);
        break;
        // http: //swluzma.esy.es/Laboratorio_6/preguntas.php?f=modificarPregunta&id=29&pregunta=nuevovalor&respuesta=modificad1o&complejidad=5
        // http: //localhost:8888/sistemas_web/Laboratorio_6/preguntas.php?f=modificarPregunta&id=30&pregunta=nuevovalor&respuesta=modificado&complejidad=5
}
function insertarPregunta($email, $pregunta, $respuesta, $complejidad)
{
    echo "estoy";
    //Generación de variables para conexión a Base de Datos
    $server = "mysql.hostinger.es";
    $user = "******";
    $password = "******";
    $bd_name = "u347232914_quiz";
    //$server = "localhost";
    //$user = "******";
    //$password = "******";
    //$bd_name = "Quiz";
    session_start();
    //Creamos una session
    //Funcion para coger la ip del cliente
    // http://stackoverflow.com/questions/15699101/get-the-client-ip-address-using-php
    function get_client_ip()
    {
        $ipaddress = '';