<?php session_start(); require_once '../model.dal/ClientesDal.php'; require_once '../model.dal/AdministradorDal.php'; require_once '../model.dal/GerenteDal.php'; require_once '../model.business/Cliente.php'; require_once '../model.business/Persona.php'; require_once '../model.business/Administrador.php'; require_once '../model.business/Gerente.php'; //Intancia de clases $clientesDal = new ClientesDal(); $adminDal = new AdministradorDal(); $gerenteDal = new GerenteDal(); $admin = new Administrador(); $cliente = new Cliente(); $gerente = new Gerente(); ////Get $username = $_POST["txt_rut"]; $password = $_POST["txt_password"]; if (crypt($password, $clientesDal->passwordClient($username)) == $clientesDal->passwordClient($username)) { $esIgual = TRUE; } else { $esIgual = FALSE; } ////SET Admin $admin->setUsername($username); $admin->setPassword(crypt($password, $adminDal->passwordAdmin($username))); ////SET Cliente $cliente->setUsername($username); $cliente->setPassword(crypt($password, $clientesDal->passwordClient($username)));
<?php require_once '../model.business/Administrador.php'; require_once '../model.dal/AdministradorDal.php'; require_once '../model.dal/LoginDal.php'; require_once '../conexion.php'; //Clases $admin = new Administrador(); $adminDal = new AdministradorDal(); $loginDal = new LoginDal(); if (isset($_POST["txt_nuevo_rut"])) { //Set Class $admin->setRut($_POST["txt_nuevo_rut"]); $admin->setNombre($_POST["txt_nuevo_nombre"]); $admin->setApellido($_POST["txt_nuevo_apellido"]); $admin->setEmail($_POST["txt_nuevo_email"]); $admin->setTelefono($_POST["txt_nuevo_telefono"]); $admin->setUsername($_POST["txt_nuevo_rut"]); $password1 = $_POST["txt_nuevo_password_1"]; $password2 = $_POST["txt_nuevo_password_2"]; $passwordDefinitiva = NULL; if ($password1 == $password2) { $passwordDefinitiva = $password1; } $password = $admin->crypt_blowfish_bydinvaders($passwordDefinitiva); $admin->setPassword($password); //Nos retornará un numero la consulta $resultado = $loginDal->insertLoginAdmin($admin); if ($passwordDefinitiva != null) { switch ($resultado) { //Si retorna 1 todo Ok