public function AuthenticationManager()
 {
     $this->control = Control::getControl();
     $this->db = $this->control->database;
     $this->utility = $this->control->utility;
     $this->crypto = new Crypto();
 }
 public function accederPruebasMate($tipo)
 {
     //funcion para comprobar que el usuario haga las preubas del dia
     date_default_timezone_set("America/Bogota");
     $fechaAct = date("Y-m-d");
     $email = $_SESSION['session'];
     $conexion = new Conexion();
     $conexion = $conexion->conectar();
     $control = new Control($email);
     $data = $control->getControl($conexion);
     $datos = $data->fetch_array(MYSQLI_ASSOC);
     $dia = $datos["dia_usuario"];
     $semana = $datos["semana_usuario"];
     $contador = $datos["contador_actividad"];
     $resultado = new Resultado();
     $result = $resultado->getResult($conexion, $email, $dia, $semana);
     $informs = $result->fetch_all(MYSQLI_ASSOC);
     $i = 0;
     if ($fechaAct != $datos["fecha"] || $result->num_rows != 0) {
         foreach ($informs as $info) {
             if ($info['prueba_tipo'] == $tipo) {
                 $i = $i + 1;
             }
         }
         if ($i == 0) {
             return true;
         } else {
             //echo "No puedes realizar esta prueba de nuevo";
             header("Location: ../msg/againmsg.html");
         }
     } else {
         echo "No puedes hacer mas pruebas por el dia de hoy. Por favor regresa mañana";
         header("Location: ../msg/endedmsg.html");
     }
 }
 public function handleRoute($path)
 {
     $currentPage = NULL;
     foreach ($this->pages as $page) {
         if ($page->getRoute() == $path) {
             $currentPage = $page;
         }
     }
     if ($currentPage != NULL) {
         if ($currentPage->hasPost()) {
             $currentPage->doPost();
         }
         if ($currentPage->hasGet()) {
             $currentPage->doGet();
         }
         if ($currentPage->isCacheable()) {
             $cache = Control::getControl()->cache->phpFastCache;
             $cachedPage = $cache->get($currentPage->getName() . "_page");
             if ($cachedPage == null) {
                 //TODO compensate for username replacement within the cache for login scripts
                 $html = $currentPage->getHTML();
                 $cache->set($currentPage->getName() . "_page", $html, 600);
                 echo $html;
             } else {
                 //TODO compensate for username replacement within the cache for login scripts
                 echo $cachedPage;
             }
         } else {
             echo $currentPage->getHTML();
         }
         //echo "DEBUG: ELAPSED TIME: ". Control::getControl()->utility->elapsedTime($currentPage->startTime, $currentPage->endTime);
     } else {
         echo "Not found";
     }
 }
 public function getControl($email)
 {
     $conexion = new Conexion();
     $conexion = $conexion->conectar();
     $datos = new Control($email);
     $info = $datos->getControl($conexion);
     return $resultado = $info->fetch_array(MYSQLI_ASSOC);
 }
 public function Crypto()
 {
     $this->control = Control::getControl();
     $this->salt[0] = "Yamv1GGzdBspCiwd";
     $this->salt[1] = "6Aorv3ZNN4BgxcTd";
     $this->salt[2] = "AxK45sxAJLycVihr";
     $this->AESKey[0] = "Gvg24rc5W8";
 }
Beispiel #6
0
 public function getControl()
 {
     /**
      * Always do this before create HTML
      */
     $this->callStyle();
     $this->control = "<input type='text' id='" . $this->id . "' class='" . $this->getCssClass() . "' style='" . $this->getStyle() . "'/>";
     return parent::getControl();
 }
Beispiel #7
0
 public function getControl()
 {
     $option = $this->addition['option'];
     $val = $this->addition['value'];
     $display = $this->addition['display'];
     $options = "<option></option>";
     foreach ($option as $opt) {
         $options .= "<option value='" . $opt->{$val} . "'>" . $opt->{$display} . "</option>";
     }
     /**
      * Always do this before create HTML
      */
     $this->callStyle();
     $this->control = "<select id='" . $this->id . "' class='" . $this->getCssClass() . "' style='" . $this->getStyle() . "'>" . $options . "</select>";
     return parent::getControl();
 }
 public function enunciado($tipo)
 {
     //funcion para obtener los enunciados de ciertas actividades
     $conexion = new Conexion();
     $conexion = $conexion->conectar();
     $email = $_SESSION['session'];
     $control = new Control($email);
     $resultado = $control->getControl($conexion);
     //se obtiene el  dia y semana en donde se encuentra el usuario
     if ($resultado->num_rows != 0) {
         //para así mismo obtener las actividades requeridas
         $datos = $resultado->fetch_array(MYSQLI_ASSOC);
         $dia = $datos["dia_usuario"];
         $semana = $datos["semana_usuario"];
     }
     $actividad = new Actividad();
     return $result = $actividad->getActByDay($conexion, $tipo, $dia, $semana);
     //return $result;
 }
 public function CacheTest()
 {
     $this->name = "cache";
     $this->control = Control::getControl();
 }
<?php

require_once "backbone/Control.class.php";
Control::getControl()->dispatcher->handleRoute(Control::getControl()->utility->getVar("module"));
 public function memoria45()
 {
     session_start();
     //seccion para calcular el tiempo que se tardo en realizar la prueba.
     $fin = microtime(true);
     $ini = $_SESSION['tIni'];
     $segundos = $fin - $ini;
     $minutos = 0;
     $segundos = round($segundos);
     while ($segundos > 59) {
         $minutos = $minutos + 1;
         $segundos = $segundos - 60;
     }
     $tiempo = $minutos . " : " . $segundos;
     $tipo = "memoria";
     $puntos = 0;
     $rango = 0;
     $conexion = new Conexion();
     $conexion = $conexion->conectar();
     $r1 = strtoupper($conexion->real_escape_string(strip_tags($_POST['1'])));
     $r2 = strtoupper($conexion->real_escape_string(strip_tags($_POST['2'])));
     $r3 = strtoupper($conexion->real_escape_string(strip_tags($_POST['3'])));
     $r4 = strtoupper($conexion->real_escape_string(strip_tags($_POST['4'])));
     $r5 = strtoupper($conexion->real_escape_string(strip_tags($_POST['5'])));
     $r6 = strtoupper($conexion->real_escape_string(strip_tags($_POST['6'])));
     $r7 = strtoupper($conexion->real_escape_string(strip_tags($_POST['7'])));
     $r8 = strtoupper($conexion->real_escape_string(strip_tags($_POST['8'])));
     $r9 = strtoupper($conexion->real_escape_string(strip_tags($_POST['9'])));
     $r10 = strtoupper($conexion->real_escape_string(strip_tags($_POST['10'])));
     $email = $_SESSION['session'];
     $control = new Control($email);
     $resultado = $control->getControl($conexion);
     if ($resultado->num_rows != 0) {
         $datos = $resultado->fetch_array(MYSQLI_ASSOC);
         $dia = $datos["dia_usuario"];
         $semana = $datos["semana_usuario"];
         $contador = $datos["contador_actividad"];
     }
     $enunciado = "numero1";
     $actividad = new Actividad();
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r1) {
             $rango = $rango + 1;
         }
     }
     $enunciado = "numero2";
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r2) {
             $rango = $rango + 1;
         }
     }
     $enunciado = "numero3";
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r3) {
             $rango = $rango + 1;
         }
     }
     $enunciado = "numero4";
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r4) {
             $rango = $rango + 1;
         }
     }
     $enunciado = "numero5";
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r5) {
             $rango = $rango + 1;
         }
     }
     $enunciado = "numero6";
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r6) {
             $rango = $rango + 1;
         }
     }
     $enunciado = "numero7";
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r7) {
             $rango = $rango + 1;
         }
     }
     $enunciado = "numero8";
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r8) {
             $rango = $rango + 1;
         }
     }
     $enunciado = "numero9";
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r9) {
             $rango = $rango + 1;
         }
     }
     $enunciado = "numero10";
     $rta = $actividad->getActividad($conexion, $tipo, $enunciado, $dia, $semana);
     //SE CONSULTA LA BD PARA EXTRAER DATOS
     if ($rta->num_rows != 0) {
         $infos = $rta->fetch_array(MYSQLI_ASSOC);
         if ($infos["respuesta"] == $r10) {
             $rango = $rango + 1;
         }
     }
     $calificacion = new Calificar($rango, $tipo, $email, $dia, $semana, $contador, $tiempo);
     $calificacion->diez($conexion);
     header("Location: ../../vista/pruebas/msg/finmsg.html");
 }
 public function Register()
 {
     $this->name = "register";
     $this->control = Control::getControl();
 }
 public function Index()
 {
     $this->name = "index";
     $this->control = Control::getControl();
 }
 public function getControl($email)
 {
     $conexion = new Conexion();
     $conexion = $conexion->conectar();
     $datos = new Control($email);
     return $datos->getControl($conexion);
 }
 public function Cache()
 {
     $this->control = Control::getControl();
     $this->phpFastCache = phpFastCache();
 }
 public function Mailer()
 {
     $this->control = Control::getControl();
 }
 public function Login()
 {
     $this->name = "login";
     $this->control = Control::getControl();
 }