Exemplo n.º 1
0
         header('location: index.php');
     }
     break;
 case 'usuarios':
     $bd = new Conexion();
     $dato = $bd->consulta("select * from usuario_table");
     $template = new Smarty(1);
     $template->assign(array('resultado' => $dato));
     $template->display('public/usuarios.tpl');
     break;
 case 'registro':
     if (isset($_POST['registro'])) {
         if (!empty($_POST['nombre']) and !empty($_POST['apellido']) and !empty($_POST['email']) and !empty($_POST['pass'])) {
             include 'includes/class.Acceso.php';
             $registro = new Acceso($_POST['nombre'], $_POST['apellido'], $_POST['email'], $_POST['pass'], null);
             $url = $registro->Registro();
             if ($url == "public/usuarios.tpl") {
                 $bd = new Conexion();
                 $dato = $bd->consulta("select * from usuario_table");
                 $template = new Smarty(1);
                 $template->assign(array('resultado' => $dato));
                 $template->display('public/usuarios.tpl');
             }
         } else {
             header('location: index.php?modo=registro&error=campos_vacios');
         }
     } else {
         if (isset($_GET['error']) and $_GET['error'] == 'campos_vacios') {
             $template = new Smarty(1);
             $template->assign(array('error' => 'ERROR: Debes llenar todos los campos para poder registrarte'));
             $template->display('public/registro.tpl');
Exemplo n.º 2
0
        if (isset($_POST['login'])) {
            if (!empty($_POST['user']) and !empty($_POST['pass'])) {
                include 'includes/class.Acceso.php';
                $login = new Acceso($_POST['user'], $_POST['pass'], '');
                $login->Login();
            } else {
                header('location: index.php');
            }
        }
        break;
    case 'registro':
        if (isset($_POST['registro'])) {
            if (!empty($_POST['user']) and !empty($_POST['pass']) and !empty($_POST['email'])) {
                include 'includes/class.Acceso.php';
                $registro = new Acceso($_POST['user'], $_POST['pass'], $_POST['email']);
                $registro->Registro();
            } else {
                echo "campos vacios";
            }
        } else {
            include 'registro.php';
        }
        break;
    case 'usuario':
        header('location: index.php?ruta=usuarios');
        break;
    default:
        include 'login.php';
        break;
}
?>