Example #1
0
    $app->render('tienda.html');
});
$app->get('/tmp_inicio.php', function () use($app) {
    $app->render('tmp_inicio.php');
});
$app->get('/configuration', function () use($app) {
    $app->render('configuration.html');
});
$app->get('/info', function () use($app) {
    $app->render('info.php');
});
//Login
$app->post('/login', function () use($app) {
    require_once 'Modelo/Usuario.php';
    $mensaje = "val_OK";
    $app->redirect($app->urlfor('resultado', array('mensaje' => $mensaje)));
    $usr = $app->request->post('idUsuario');
    $pass = $app->request->post('pass');
    if (isset($usr) && isset($pass)) {
        $result = Usuario::comprobarUsuario($usr, $pass);
        if ($result == 1) {
            $app->redirect($app->urlFor('Inicio'));
        } else {
            if ($result == 0) {
                $app->flash('message', "No existe el usuario");
                $app->redirect($app->urlFor('Inicio'));
            } else {
                $app->flash('message', "El usuario no está validado, valida para poder acceder.");
                $app->redirect($app->urlFor('Inicio'));
            }
        }
Example #2
0
 $ape = trim($req->post("apellido"));
 $telef = trim($req->post("telefono"));
 $email = trim($req->post("correo"));
 $result = Cliente::nuevoCliente($nom_empresa, $nom, $ape, $email, $telef);
 //0->KO / 1->OK / 2->Existe el usuario / 3->registro OK correo KO
 /*Códigos de mensajes= 
 		
 		-err_reg_usr-->Error al registrar el usuario
 		-usr_reg_OK-->Usuario registrado correctamente.
 		-usr_em_exist-->Usuario o email existentes
 		-usr_OK_em_F -->Usuario registrado, correo fallido
 		*/
 if ($result == 0) {
     //Utils::escribeLog("KO","debug");
     $mensaje = "err_reg_usr";
     $app->redirect($app->urlfor('resultado', array('mensaje' => $mensaje)));
 } else {
     if ($result == 1) {
         //Utils::escribeLog("OK","debug");
         $mensaje = "usr_reg_OK";
         $app->redirect($app->urlfor('resultado', array('mensaje' => $mensaje)));
     } else {
         if ($result == 2) {
             //Utils::escribeLog("Existe","debug");
             $mensaje = "usr_em_exist";
             $app->redirect($app->urlfor('resultado', array('mensaje' => $mensaje)));
         } else {
             //Utils::escribeLog("Existe","debug");
             $mensaje = "usr_OK_em_F";
             $app->redirect($app->urlfor('resultado', array('mensaje' => $mensaje)));
         }