public function registerUser() { $m = new Model(Config::$mvc_bd_nombre, Config::$mvc_bd_usuario, Config::$mvc_bd_clave, Config::$mvc_bd_hostname); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $result = $m->registerUser($_POST['nick'], $_POST['nombre'], $_POST['apellidos'], $_POST['email'], $_POST['password']); } if ($result == 'NickRepeated') { $text = "UPS! Este Nick ya está utilizado. Prueba otro!"; require __DIR__ . '/templates/errorAlertNoUser.php'; } else { if ($result == 'EmailRepeated') { $text = "UPS! Este Email ya está utilizado. Prueba otro!"; require __DIR__ . '/templates/errorAlertNoUser.php'; } else { copy('web/images/user.png', 'web/images/users/user.jpg'); rename("web/images/users/user.jpg", "web/images/users/" . $_POST['nick'] . ".jpg"); $reslt = $m->getlogin($_POST['nick'], $_POST['password']); if ($reslt == 'login') { $this->userHomePage(); } else { header("Location: ./usuario y password no coinciden"); } } } }