コード例 #1
0

<?php 
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
//echo "llamado al script";
if (isset($_FILES['fileimage']) && isset($_POST['cod_estud']) && isset($_POST['tipo_img'])) {
    $database = new funciones_BD();
    $tipo = $_POST['tipo_img'];
    $id_student = $_POST['cod_estud'];
    //echo "parametros enviados: tipo=".$tipo.",id=".$id_student;
    //variable para notificar de errores: 0 significa no errores
    $error = 0;
    //validando si el tipo de imagen es imagen de ficha de seguridad:
    if (strcasecmp($tipo, "seguridad") == 0) {
        //echo "Ingresa a SEGURIDAD";
        //consultando si el estudiante ya tiene registrada una imagen de tipo ficha de seguridad:
        $resultset_img = $database->getImageOfSafetyForStudent($id_student);
        //echo "despues de primera consulta a BD";
        if (mysql_num_rows($resultset_img) > 0) {
            //si hay registros entonces se debe cargar la img y actualizar la BD
            //echo "Aun no hay registros en la BD";
            //se mueve el archivo a la ubicacion predefinida:
            if ($_FILES["fileimage"]["error"] == 0 && $_FILES['fileimage']["name"] != "") {
                if (move_uploaded_file($_FILES['fileimage']['tmp_name'], "imgsfichasphotos/" . $_FILES["fileimage"]["name"])) {
                    //si el archivo se ha movido correctamente entonces se actualiza el registro en la BD:
                    $database->updateNameSecurityImageStudent($id_student, "imgsfichasphotos/" . $_FILES["fileimage"]["name"]);
                    //echo "El archivo se ha movido correctamente";
                } else {
                    $error = 1;
                    //error 1 no se ha podido mover el archivo
コード例 #2
0
<?php

/*LOGIN*/

$usuario = $_POST['usuario'];
$passw = $_POST['password'];

require_once 'funciones_bd.php';
$db = new funciones_BD();
	if($db->login($usuario,$passw)){

	$resultado[]=array("logstatus"=>"0");
	}else{
	$resultado[]=array("logstatus"=>"1");
	}
	
	

echo json_encode($resultado);




?>
コード例 #3
0
    //$response_data['respuesta'] = "0";
    $response_data[] = array("respuesta" => "0");
} else {
    $id_estud = $_POST['id_estudiante'];
    $id_test = $_POST['id_test'];
    $id_paso = $_POST['id_paso'];
    $id_preg = $_POST['id_pregunta'];
    $resp = $_POST['respuesta'];
    $resp_def = $_POST['resp_definitiva'];
    $tiempo_res = $_POST['tiempo_respuesta'];
    $intento = $_POST['intento'];
    $intento_resp = $_POST['intento_resp'];
    /*
    $id_estud = $_GET['id_estudiante'];
    $id_test = $_GET['id_test'];
    $id_paso = $_GET['id_paso'];
    $id_preg = $_GET['id_pregunta'];
    $resp = $_GET['respuesta'];
    $resp_def = $_GET['resp_definitiva'];
    $tiempo_res = $_GET['tiempo_respuesta'];
    */
    $data_ins = new funciones_BD();
    if ($data_ins->insertNewAnswerToQuest($id_estud, $id_test, $id_paso, $id_preg, $resp, $resp_def, $tiempo_res, $intento, $intento_resp)) {
        //$response_data['respuesta'] = "1";
        $response_data[] = array("respuesta" => "1");
    } else {
        //$response_data['respuesta'] = "0";
        $response_data[] = array("respuesta" => "0");
    }
}
echo "" . json_encode($response_data);
コード例 #4
0
ファイル: adduser.php プロジェクト: b4du3l/startmvc
<?php

$usuario = $_POST['usuario'];
$passw = $_POST['password'];
require_once 'funciones_bd.php';
$db = new funciones_BD();
if ($db->isuserexist($usuario, $passw)) {
    echo " Este usuario ya existe en la base de datos!";
} else {
    if ($db->adduser($usuario, $passw)) {
        echo " Registro guardado correctamentet";
    } else {
        echo "Se tosto, a ocurrido un error, revise....:v.";
    }
}
?>



コード例 #5
0
<?php

define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
//echo "Codigo: ".$_POST["codigo"]."</br>";
$codigo = $_POST["codigo"];
if (!isset($_POST["codigo"])) {
    print "ERROR: El codigo no ha sido enviado!!";
}
if ($codigo == "") {
    print "ERROR - Codigo vacio no permitido";
} else {
    $db = new funciones_BD();
    //echo "POST cod= ".$codigo;
    $resultado = $db->validate_auth_use($codigo);
    /*
     *Esto es para depuracion:
    echo "res: ";
    while($row = mysql_fetch_row($resultado)){
        echo "id: ".$row[0]." nom=".$row[1]." validado=".$row[3]." autor=".$row[4];
    }
    */
    //validando si el codigo esta registrado en la base de datos:
    if (mysql_num_rows($resultado) == 0) {
        print "0";
        exit;
    } else {
        print "1";
    }
}
コード例 #6
0
<?php

include "valida.php";
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
if (!isset($_POST['nombres']) || !isset($_POST['apellidos'])) {
    header("location: ingresarstudents.php?error=1");
} elseif ($_POST["nombres"] == "" || $_POST["apellidos"] == "") {
    header("location: ingresarstudents.php?error=2");
} else {
    $data_conn = new funciones_BD();
    //se hace la insercion del estudiante en la tabla students y se recupera el codigo asignado:
    if ($data_conn->insert_student($_POST["nombres"], $_POST["apellidos"])) {
        $codig = $data_conn->getLastStudentCode();
        $row = mysql_fetch_row($codig);
        //echo "<br><p>cod: ".$row[0]."</p>";
        //print_r($codig);
        //se retorna la confirmacion y el codigo de estudiante que se ha insertado:
        header("location: ingresarstudents.php?conf=1&cod=" . $row[0]);
    } else {
        header("location: ingresarstudents.php?error=3");
    }
}
コード例 #7
0
<?php

define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
if (!isset($_POST['json'])) {
    $response_data[] = array("respuesta" => "0");
} elseif ($_POST['json'] == "") {
    $response_data[] = array("respuesta" => "0");
} else {
    $json = $_POST['json'];
    //echo "</br>".$json;
    $db_conexion = new funciones_BD();
    $array_navigation = json_decode($json, true);
    $res = false;
    //print_r($array_navigation);
    foreach ($array_navigation as $navig) {
        //echo "</br>Interfaz: ".$navig['interfaz'].",fecha: ".$navig['fecha'];
        $res = $db_conexion->insertNavigationRegistry($navig['id_estudiante'], $navig['fecha'], $navig['interfaz'], $navig['paso'], $navig['marker'], $navig['tipo']);
        //echo "</br>Res insert: ".$res;
    }
    //cierra foreach
    if ($res) {
        $response_data[] = array("respuesta" => "1");
    } else {
        $response_data[] = array("respuesta" => "0");
    }
    //retornando un identificador de que se han insertado los datos correctamente o no en la BD:
    echo "" . json_encode($response_data);
}
コード例 #8
0
ファイル: olvido.php プロジェクト: adri9205/EvaluaMed
<?php 
/*Olvido*/
$usuario = $_POST['usuario'];
require_once 'correo.php';
$db = new funciones_BD();
if ($db->olvido($usuario)) {
    $to = $usuario;
    $subject = "Olvido de contraseña";
    $txt = "Lo sentimos, tu usuario no existe. Solicita ayuda al administrador. ";
    $headers = "From: mensajes@evaluacionqx.com" . "\r\n" . "CC: mensajes@evaluacionqx.com";
    mail($to, $subject, $txt);
    $resultado[] = array("logstatus" => "0");
} else {
    $sql = mysql_query("select password from evaluadores where id_evaluadores = '{$usuario}'");
    while ($row = mysql_fetch_assoc($sql)) {
        $output[] = $row;
        json_encode($output);
        $body .= " \n " . "Has solicitado tu contraseña" . " \n " . " \n " . "Password : "******" \n ";
    }
    $to = $usuario;
    $subject = "Olvido de contraseña";
    //$txt = "Tu password es: ".$row["password"];
    $headers = "From: mensajes@evaluacionqx.com" . "\r\n" . "CC: mensajes@evaluacionqx.com";
    mail($to, $subject, $body);
    $resultado[] = array("logstatus" => "1");
}
echo json_encode($resultado);
//echo json_encode($output);
コード例 #9
0
ファイル: getlocation.php プロジェクト: Jozkee/Embebidos
<?php 
/*LOGIN*/
$usuario = $_POST['usuario'];
require_once 'funciones_bd.php';
$db = new funciones_BD();
//int userID;
try {
    $resultado[] = array("latitud" => (string) $db->getUserLocation($usuario)[0], "longitud" => (string) $db->getUserLocation($usuario)[1]);
} catch (Exception $e) {
    $resultado[] = array("latitud" => "0", "longitud" => "0");
}
echo json_encode($resultado);
コード例 #10
0
    <script src="Scripts/html5shiv.js"></script>
    <script src="Scripts/respond.min.js"></script>
    <link href="Styles/bootstrap-toggle.css" rel="stylesheet" />
    <style> body { padding-top:70px } </style>
</head>
<body>
     
    <div class="container">
        
        <?php 
include "valida.php";
require_once "menu_admin.php";
//configurando variables y archivo con funciones de la bd:
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
$datab = new funciones_BD();
//validando si provienen errores desde otra pagina que redireccione a esta:
if (isset($_GET["error"])) {
    echo "<p>";
    if ($_GET["error"] == "1") {
        echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: Los datos del estudiante no pueden ser vacios.</strong></div>";
    } elseif ($_GET["error"] == "2") {
        echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: No se ha podido ingresar el estudiante. Porfavor contacte al administrador del sitio web.</strong></div>";
    } elseif ($_GET["error"] == "3") {
        echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: No se ha podido actualizar el código. Porfavor contacte al administrador de la aplicación.</strong></div>";
    }
} elseif (isset($_GET["conf"])) {
    if ($_GET["conf"] == "1") {
        $codi = $_GET["cod"];
        echo "<div class='alert alert-dismissible alert-success'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          El estudiante ha sido registrado con el <strong>código: " . $codi . "</strong></div>";
    } elseif ($_GET["conf"] == "2") {
コード例 #11
0
<?php

define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
if (!isset($_POST["username"]) || !isset($_POST["password"])) {
    header("location: iniciosesion.php?error=1");
    //echo "<p>Error variables no definidas</p>";
} elseif ($_POST["username"] == "" || $_POST["password"] == "") {
    header("location: iniciosesion.php?error=2");
    //echo "<p>Error variables vacias</p>";
} else {
    $db = new funciones_BD();
    if ($db->login($_POST["username"], $_POST["password"])) {
        header("location: iniciosesion.php?error=3");
    } else {
        //$user = $db->consultar_datos_usuario($_POST["user"]);
        session_start();
        $_SESSION["username"] = $_POST["username"];
        //$_SESSION["nombre"] = $user["nombre"];
        //$_SESSION["apellido"] = $user["apellido"];
        header("location: index_admin.php");
    }
}
コード例 #12
0
<?php

define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
//echo "Codigo: ".$_POST["codigo"]."</br>";
$codigo = $_POST["codigo"];
if (!isset($_POST["codigo"])) {
    print "ERROR: El codigo no ha sido enviado!!";
}
if ($codigo == "") {
    print "ERROR - Codigo vacio no permitido";
} else {
    $db = new funciones_BD();
    //echo "POST cod= ".$codigo;
    $resultado = $db->validate_user($codigo);
    //echo "res: ".$resultado['nombres'];
    //validando si el codigo esta registrado en la base de datos:
    if (mysql_num_rows($resultado) == 0) {
        print "0";
        exit;
    } else {
        //invalidando el codigo para que no se vuelva a utilizar:
        if ($db->invalidate_code($codigo)) {
            print "1";
        } else {
            print "1";
        }
    }
}
コード例 #13
0
    <script src="Scripts/html5shiv.js"></script>
    <script src="Scripts/respond.min.js"></script>
    <link href="Styles/bootstrap-toggle.css" rel="stylesheet" />
    <style> body { padding-top:70px } </style>
</head>
<body>
     
    <div class="container">
        
        <?php 
include "valida.php";
require_once "menu_admin.php";
//configurando variables y archivo con funciones de la bd:
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
$datab_quest = new funciones_BD();
if (!isset($_GET['id'])) {
    header("location: consultar_pregs.php?error=1");
    exit;
} else {
    //validando si provienen errores desde otra pagina que redireccione a esta:
    if (isset($_GET["error"])) {
        echo "<p>";
        if ($_GET["error"] == "1") {
            echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: Los datos de la pregunta no están completos.</strong></div>";
        } elseif ($_GET["error"] == "2") {
            echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: Los datos de la pregunta no están completos.</strong></div>";
        } elseif ($_GET["error"] == "3") {
            echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: El formato del archivo no es válido. Sólo se permiten archivos .jpg, .png y .gif. La pregunta no se ha guardado</strong></div>";
        } elseif ($_GET["error"] == "4") {
            echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: No se ha podido procesar (mover) el archivo que ha subido. Porfavor contacte con el administrador del sistema.</strong></div>";
コード例 #14
0
<?php

define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
$num_pregs_pos = $_POST['numero_pregs'];
//este valor aunque se recibe por POST se recupera realmente de la BD.
$paso_pregs = $_POST['paso'];
$id_student = $_POST['id_estudiante'];
$tipo_test = $_POST['tipo_test'];
//$num_pregs = $_GET['numero_pregs'];
//$paso_pregs = $_GET['paso'];
//$id_student = $_GET['id_estudiante'];
//definiendo la variable que almacena el intento actual del test:
$intento_actual = "";
$conn = new funciones_BD();
$num_pregs = 5;
//La cantidad de preguntas la define el profesor por medio de la app web. Por lo tanto
//aqui vamos a recuperar la cantidad de preguntas que haya definido el profesor o 5 por default
$res_cantidad_rows = $conn->getQuantitiesByStep($paso_pregs);
if (mysql_numrows($res_cantidad_rows) > 0) {
    $cantidad_row = mysql_fetch_array($res_cantidad_rows, MYSQL_ASSOC);
    $num_pregs = $cantidad_row['cantidad_preguntas'];
} else {
    //por defecto si no hay registros en la BD el numero de preguntas sera 5
    $num_pregs = 5;
}
//creando un array para almacenar las preguntas del test activo:
$pregs_test_activo = array();
//aca tengo que primero validar si el estudiante ya tiene un test activo que no ha respondido entonces
//se retorna ese test:
$test_activo_results = $conn->consultarTestEstudiantePaso($id_student, $paso_pregs, $tipo_test);
コード例 #15
0
    <script src="Scripts/html5shiv.js"></script>
    <script src="Scripts/respond.min.js"></script>
    <link href="Styles/bootstrap-toggle.css" rel="stylesheet" />
    <style> body { padding-top:70px } </style>
</head>
<body>
     
    <div class="container">
        
        <?php 
include "valida.php";
require_once "menu_admin.php";
//configurando variables y archivo con funciones de la bd:
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
$databas = new funciones_BD();
if (!isset($_GET['id'])) {
    header("location: consultar_quantities.php?error=1");
    exit;
} elseif ($_GET['id'] == "") {
    header("location: consultar_quantities.php?error=2");
    exit;
} else {
    $id_quantity = $_GET['id'];
    $fase_id = "";
    $paso_id = "";
    $nombre_fase = "";
    $nombre_paso = "";
    $numero_pregs = 0;
    $numero_aprobar = 0;
    //consultando los datos de las cantidades:
コード例 #16
0
ファイル: getuserid.php プロジェクト: Jozkee/Embebidos
<?php 
/*LOGIN*/
$usuario = $_POST['usuario'];
require_once 'funciones_bd.php';
$db = new funciones_BD();
//int userID;
try {
    //userID=$db->getUSerID($usuario);
    $resultado[] = array("userid" => (string) $db->getUserID($usuario));
} catch (Exception $e) {
    $resultado[] = array("userid" => "0");
}
echo json_encode($resultado);
コード例 #17
0
<?php

include "valida.php";
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
//echo "id=".$_GET['id_preg'];
if (!isset($_GET['id_preg'])) {
    //header("location: consultar_pregs.php?error=3");
    //exit;
} else {
    if ($_GET['id_preg'] == "") {
        //header("location: consultar_pregs.php?error=3");
        //exit;
    } else {
        $id_quest = $_GET['id_preg'];
        $data_connect = new funciones_BD();
        //ahora se procede a eliminar el archivo de imagen que se habia cargado al servidor:
        //primero se consultan los datos de la pregunta:
        $preg_data_resultset = $data_connect->getQuestionDataByID($id_quest);
        $data_preg = mysql_fetch_array($preg_data_resultset, MYSQL_ASSOC);
        //se procede a eliminar el archivo si es diferente del . porque el punto significa que no se cargo ningun archivo:
        if (strcasecmp($data_preg['archivo_imagen'], ".") != 0) {
            unlink($data_preg['archivo_imagen']);
        }
        if ($data_connect->deleteQuestionByID($id_quest)) {
            header("location: consultar_pregs.php?conf=1");
            exit;
        } else {
            header("location: consultar_pregs.php?error=4");
            exit;
        }
コード例 #18
0
<?php

include "valida.php";
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
if (!isset($_POST['id_record_change']) || !isset($_POST['num_pregs']) || !isset($_POST['num_aprobar'])) {
    header("location: consultar_quantities.php?error=1");
    exit;
} elseif ($_POST["id_record_change"] == "" || $_POST["num_pregs"] == "" || $_POST["num_aprobar"] == "") {
    header("location: consultar_quantities.php?error=1");
    exit;
} else {
    $id = $_POST['id_record_change'];
    $num_pregs = $_POST['num_pregs'];
    $num_aprob = $_POST['num_aprobar'];
    //validando si el numero de preguntas para aprobar el mayor que el numero de preguntas disponible
    if ($num_aprob > $num_pregs) {
        header("location: edit_quantities.php?error=1&id=" . $id);
    } else {
        $data_update = new funciones_BD();
        if ($data_update->updateQuantitiesByID($id, $num_pregs, $num_aprob)) {
            header("location: consultar_quantities.php?conf=1");
            exit;
        } else {
            header("location: consultar_quantities.php?error=3");
            exit;
        }
    }
}
コード例 #19
0
ファイル: getcommented.php プロジェクト: Jozkee/Embebidos
<?php 
/*LOGIN*/
$user = $_POST['user'];
require_once 'funciones_bd.php';
$db = new funciones_BD();
//$array=$db->getNear($latitude,$longitude,$radius);
$array = $db->getCommented($user);
$string = "[";
if ($row = mysql_fetch_array($array)) {
    do {
        //echo "{\"ThreadID"."\"".":"."\"".$row[1]."\"".",";
        //echo "\"Desc"."\"".":"."\"".$row[0]."\""."}\n";
        $string = $string . "{\"ThreadID" . "\"" . ":" . "\"" . $row[1] . "\"" . ", " . "\"Desc" . "\"" . ":" . "\"" . $row[0] . "\"" . "},";
    } while ($row = mysql_fetch_array($array));
} else {
    $string = $string . "{\"ThreadID\":\"0\",\"Desc\":\"Error, no se encontraron comentarios suyos.\"},";
}
$string = $string . "{\"ThreadID\":\"0\",\"Desc\":\"0\"}]";
echo $string;
?>

コード例 #20
0
ファイル: getnear.php プロジェクト: Jozkee/Embebidos
<?php 
/*LOGIN*/
$latitude = $_POST['latitud'];
$longitude = $_POST['longitud'];
$radius = $_POST['radio'];
require_once 'funciones_bd.php';
$db = new funciones_BD();
$array = $db->getNear($latitude, $longitude, $radius);
//$array=$db->getNear(0.0,0.0,237.0);
$string = "[";
if ($row = mysql_fetch_array($array)) {
    do {
        //echo "{\"ThreadID"."\"".":"."\"".$row[1]."\"".",";
        //echo "\"Desc"."\"".":"."\"".$row[0]."\""."}\n";
        $string = $string . "{\"ThreadID" . "\"" . ":" . "\"" . $row[1] . "\"" . ", " . "\"Desc" . "\"" . ":" . "\"" . $row[0] . "\"" . "},";
    } while ($row = mysql_fetch_array($array));
} else {
    $string = $string . "{\"ThreadID\":\"0\",\"Desc\":\"Error, no se encontraron temas\"},";
}
$string = $string . "{\"ThreadID\":\"0\",\"Desc\":\"0\"}]";
echo $string;
?>

コード例 #21
0
    <script src="Scripts/html5shiv.js"></script>
    <script src="Scripts/respond.min.js"></script>
    <link href="Styles/bootstrap-toggle.css" rel="stylesheet" />
    <style> body { padding-top:70px } </style>
</head>
<body>
     
    <div class="container">
        
        <?php 
include "valida.php";
require_once "menu_admin.php";
//configurando variables y archivo con funciones de la bd:
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
$datab = new funciones_BD();
//validando si provienen errores desde otra pagina que redireccione a esta:
if (isset($_GET["error"])) {
    echo "<p>";
    if ($_GET["error"] == "1") {
        echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: Los datos de la pregunta no están completos.</strong></div>";
    } elseif ($_GET["error"] == "2") {
        echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: Los datos de la pregunta no están completos.</strong></div>";
    } elseif ($_GET["error"] == "3") {
        echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: El formato del archivo no es válido. Sólo se permiten archivos .jpg, .png y .gif. La pregunta no se ha guardado</strong></div>";
    } elseif ($_GET["error"] == "4") {
        echo "<div class='alert alert-dismissible alert-danger'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          <strong>Error: No se ha podido procesar (mover) el archivo que ha subido. Porfavor contacte con el administrador del sistema.</strong></div>";
    }
} elseif (isset($_GET["conf"])) {
    if ($_GET["conf"] == "1") {
        echo "<div class='alert alert-dismissible alert-success'>\n                          <button type='button' class='close' data-dismiss='alert'>×</button>\n                          La pregunta ha sido agregada correctamente al banco de preguntas.</div>";
コード例 #22
0
ファイル: getcomments.php プロジェクト: Jozkee/Embebidos
<?php 
/*LOGIN*/
$tID = $_POST['thread'];
require_once 'funciones_bd.php';
$db = new funciones_BD();
$array = $db->getComments($tID);
//$array=$db->getNear(0.0,0.0,237.0);
$string = "[";
if ($row = mysql_fetch_array($array)) {
    do {
        //echo "{\"ThreadID"."\"".":"."\"".$row[1]."\"".",";
        //echo "\"Desc"."\"".":"."\"".$row[0]."\""."}\n";
        $string = $string . "{\"ThreadID" . "\"" . ":" . "\"" . $row[1] . "\"" . ", " . "\"Desc" . "\"" . ":" . "\"" . $row[0] . "\"" . "},";
    } while ($row = mysql_fetch_array($array));
} else {
    $string = $string . "{\"ThreadID\":\"0\",\"Desc\":\"No se encontraron comentarios\"},";
}
$string = $string . "{\"ThreadID\":\"0\",\"Desc\":\"0\"}]";
echo $string;
?>

コード例 #23
0
<?php

include "valida.php";
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
$phase = $_GET['phase'];
$paso = $_GET['step'];
if (!$phase && !$paso) {
    return false;
} elseif ($paso == "0") {
    return false;
}
$data_connection = new funciones_BD();
//obteniendo el conjunto de preguntas para un paso:
$res_consulta = $data_connection->getQuestionsForStep($paso);
//creando el array de elementos
$questions_load = array();
while ($pregunta = mysql_fetch_array($res_consulta, MYSQL_ASSOC)) {
    $questions_load[$pregunta['id_pregunta']] = $pregunta['enunciado'];
}
//para depuracion y verificar si el array de elementos que se pasa al componente select se esta creando bien:
//print_r($steps_load);
/**
 *El siguiente codigo HTML se reemplaza en el div que se llama pasoAjax de la pagina add_questions.php
 */
?>
<div class="col-lg-12">
                                
    <table class="table table-responsive table-striped table-hover ">
        <thead>
            <tr>
コード例 #24
0
                    //si el archivo no se ha podido mover bien entonces se actualiza el nombre con un punto
                    $data_conn->updateFileNameQuestion($last_id, ".");
                    header("location: add_questions.php?error=4");
                    exit;
                }
                // cierra if interno
            } else {
                //no se pudo insertar la pregunta
                header("location: add_questions.php?conf=2");
                exit;
            }
        } else {
            //else de error cuando el formato de archivo no es valido
            header("location: add_questions.php?error=3");
            exit;
        }
    } else {
        //si el archivo no se ha cargado:
        //el nombre del archivo sera un punto si no se envia ningun archivo:
        $nom_archivo = ".";
        $data_con = new funciones_BD();
        if ($data_con->insertNewQuestion($fase_form, $paso_form, $preg_form, $opciona_form, $opcionb_form, $opcionc_form, $opciond_form, $nom_archivo, $respuesta_form)) {
            header("location: add_questions.php?conf=1");
            exit;
        } else {
            header("location: add_questions.php?conf=2");
            exit;
        }
        // cierra if interno
    }
}
コード例 #25
0
<?php

define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
if (!isset($_POST['idtest']) || !isset($_POST['idstudent']) || !isset($_POST['idpaso']) || !isset($_POST['aprobado']) || !isset($_POST['intento'])) {
    $response_data[] = array("respuesta" => "0");
} elseif ($_POST['idtest'] == "" || $_POST['idstudent'] == "" || $_POST['idpaso'] == "" || $_POST['aprobado'] == "" || $_POST['intento'] == "") {
    $response_data[] = array("respuesta" => "0");
} else {
    //obj conexion a BD:
    $conect = new funciones_BD();
    $id_test = $_POST['idtest'];
    $id_estud = $_POST['idstudent'];
    $id_paso = $_POST['idpaso'];
    $test_aprobado = $_POST['aprobado'];
    $intento = $_POST['intento'];
    //validando si el intento es 1
    if (strcmp($intento, "1") == 0) {
        //se actualiza el intento del TEST:
        $conect->updateIntentoTest($id_test, $intento);
        //Si el test fue aprobado 1 entonces se cierra el test y se da por aprobado:
        if (strcmp($test_aprobado, "1") == 0) {
            $conect->updateFinishTest($id_test, $test_aprobado, $intento);
        }
        $id_pregunta = "";
        //registrando las preguntas del test como intento 1 enviado:
        $resultset_preguntas = $conect->consultarPreguntasTestByID($id_test);
        while ($pregunta = mysql_fetch_array($resultset_preguntas, MYSQL_ASSOC)) {
            //obteniendo el ID de la pregunta para actualizarla:
            $id_pregunta = $pregunta['id_pregunta'];
            //con el id de pregunta se consulta la tabla de respuestas y se busca la ultima respuesta insertada para el test y el estudiante correspondiente:
コード例 #26
0
<?php

$curso = $_POST["curso"];
$nombre = $_POST["nombre"];
$cedula = $_POST["cedula"];
$email = $_POST["email"];
$celular = $_POST["celular"];
$direccion = $_POST["direccion"];
$ciudad = $_POST["ciudad"];
require_once 'funciones_bd.php';
$db = new funciones_BD();
if ($db->addCurso($curso, $nombre, $cedula, $email, $celular, $direccion, $ciudad)) {
    ?>
		<meta http-equiv="REFRESH" content="0,url=../Interfaces/index.php">
		<script type="text/javascript">
			alert("Inscrito Correctamente, Nos Pondremos en Contacto con Usted. Gracias");
		</script>

    <?php 
} else {
    ?>

		<meta http-equiv="REFRESH" content="0,url=../Interfaces/index.php">
		<script type="text/javascript">
			alert("No se Pudo Enviar tu Inscripcion");
		</script>

    <?php 
}
echo json_encode($resultado);
コード例 #27
0
ファイル: updatelocation.php プロジェクト: Jozkee/Embebidos
<?php

$usuario = $_POST['usuario'];
$latitude = $_POST['latitud'];
$longitude = $_POST['longitud'];
require_once 'funciones_bd.php';
$db = new funciones_BD();
if ($db->ifLocationExists($usuario)) {
    if ($db->updateLocation($usuario, $latitude, $longitude)) {
        echo "Se actualizo la ubicacion correctamente.";
    } else {
        echo "Error actualizando ubicacion.";
    }
} else {
    if ($db->addLocation($usuario, $latitude, $longitude)) {
        echo "Se agrego la ubicacion correctamente.";
    } else {
        echo "Se produjo un error al añadir.";
    }
}
?>



コード例 #28
0
<?php

include "valida.php";
define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
$phase = $_GET['phase'];
if (!$phase) {
    return false;
}
$data_connection = new funciones_BD();
$res_consulta = $data_connection->getStepsNamesByPhase($phase);
/*
$steps = array(
    1 => array('Limpieza','Secado','Localizar Irregularidades'),
    2 => array('Disco 80','Disco 120','Disco 180')
    
);

$steps_load = $steps[$phase];
*/
//creando el array de elementos
$steps_load = array();
while ($nom_paso = mysql_fetch_row($res_consulta)) {
    $steps_load[$nom_paso[0]] = $nom_paso[2];
}
//para depuracion y verificar si el array de elementos que se pasa al componente select se esta creando bien:
//print_r($steps_load);
/**
 *El siguiente codigo HTML se reemplaza en el div que se llama pasoAjax de la pagina add_questions.php
 */
?>
コード例 #29
0
<?php

define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
if (!isset($_POST['json']) || !isset($_POST['tipo']) || !isset($_POST['estudiante'])) {
    $response_data[] = array("respuesta" => "0");
} elseif ($_POST['json'] == "" || $_POST['tipo'] == "" || $_POST['estudiante'] == "") {
    $response_data[] = array("respuesta" => "0");
} else {
    $json = $_POST['json'];
    //echo "</br> El json es: ".$json;
    $id_estudiante = $_POST['estudiante'];
    $tipo_secuencia = $_POST['tipo'];
    $type_sequence = 0;
    //iniciando conexion a la BD
    $data_base = new funciones_BD();
    if (strcasecmp($tipo_secuencia, "phases") == 0) {
        $type_sequence = 0;
    } elseif (strcasecmp($tipo_secuencia, "phase1") == 0) {
        $type_sequence = 1;
    } elseif (strcasecmp($tipo_secuencia, "phase2") == 0) {
        $type_sequence = 2;
    } elseif (strcasecmp($tipo_secuencia, "phase3") == 0) {
        $type_sequence = 3;
    } elseif (strcasecmp($tipo_secuencia, "phase4") == 0) {
        $type_sequence = 4;
    } elseif (strcasecmp($tipo_secuencia, "phase5") == 0) {
        $type_sequence = 5;
    } elseif (strcasecmp($tipo_secuencia, "phase6") == 0) {
        $type_sequence = 6;
    }
コード例 #30
0
<?php

define('AT_INCLUDE_PATH', 'include/');
include_once AT_INCLUDE_PATH . 'funciones_bd.php';
if (!isset($_POST['paso'])) {
    $response_data[] = array("cantidad" => "-1");
} elseif ($_POST['paso'] == "") {
    $response_data[] = array("cantidad" => "-1");
} else {
    $paso_pregs = $_POST['paso'];
    $connec = new funciones_BD();
    //aqui tengo que hacer la consulta
    $resultset_cantidades = $connec->getQuantitiesByStep($paso_pregs);
    if (mysql_numrows($resultset_cantidades) > 0) {
        $cantidades_row = mysql_fetch_array($resultset_cantidades, MYSQL_ASSOC);
        $cant = $cantidades_row['cantidad_aprobar'];
        $response_data[] = array("cantidad" => $cant);
    } else {
        $response_data[] = array("cantidad" => "-1");
    }
}
echo "" . json_encode($response_data);