Add files via upload

This commit is contained in:
Fernando Méndez
2021-06-01 12:22:08 +02:00
committed by GitHub
parent 258a7bfd05
commit 72b1bab936
3 changed files with 22 additions and 18 deletions

View File

@ -93,18 +93,23 @@ class FormRegister extends Form {
if ($this->user->data_seek(0)) {
$result[] = "El email ya está registrado.";
} else {
$bd->createUser("", $nombre, $email, $password, "user");
$this->user = $bd->selectUser($nombre, $password);
if ($this->user) {
$this->user->setPass(null);
$_SESSION["user"] = serialize($this->user);
$_SESSION["nombre"] = $this->user->getName();
$_SESSION["rol"] = $this->user->getRol();
$_SESSION["login"] = true;
$img = "../img/users/user.jpg"; //USER_PICS
$profile_img = "../img/users/".$nombre.".jpg";
copy($img, $profile_img);
$result = ROUTE_APP."register/register.php";
if($bd->createUser("", $nombre, $email, $password, "user")){
$this->user = $bd->selectUser($nombre, $password);
if ($this->user) {
$this->user->setPass(null);
$_SESSION["user"] = serialize($this->user);
$_SESSION["nombre"] = $this->user->getName();
$_SESSION["rol"] = $this->user->getRol();
$_SESSION["login"] = true;
$img = "../img/users/user.jpg"; //USER_PICS
$profile_img = "../img/users/".$nombre.".jpg";
copy($img, $profile_img);
$result = ROUTE_APP."register/register.php";
} else {
$result[] = "Ha ocurrido un error al iniciar la sesión\nPero el usuario se creó correctamente.";
}
} else {
$result[] = "Ha ocurrido un error al crear el usuario.";
}
}
}