function doRegister() { $name = $_REQUEST['name']; $email = $_REQUEST['email']; $password = $_REQUEST['password']; $password_again = $_REQUEST['password_again']; $user = new User($this->dbconn); if (!$user->validateName($name) or !$user->validateEmail($email) or !$user->validatePassword($password, $password_again)) { $error_data = 1; } if (!isset($error_data)) { $this->dbconn->debug = true; $user->name = $name; $user->email = $email; $user->password = $password; if ($user->save()) { $_SESSION['user_id'] = $user->id; header('Location: index.php'); exit; } else { $this->showErrors(); $this->register(); } } else { $this->showErrors(); $this->register(); } }
/** * Vartotojo duomenu keitimas */ } elseif ($_GET['action'] == "edit") { $user->getUserData($_GET['id']); if (isset($_GET['name'])) { $userName = $_GET['name']; $email = $_GET['email']; } else { $userName = $user->getUserName(); $email = $user->getUserEmail(); } $id = $_GET['id']; if (isset($_GET['Ivesti']) && $_GET['Ivesti'] == 'Įvesti') { $validation = 1; if (!$user->validateName($_GET['name'])) { echo "Neteisingai įvestas vardas, galimos tik raidės<br>"; $validation = 0; } if (!$user->validateEmail($_GET['email'])) { echo "Neteisingai įvestas email <br>"; $validation = 0; } if ($validation) { $user->changeUser($_GET['name'], $_GET['email'], $_GET['id']); echo "Vartotojas sekmingai įvestas"; } } include "./inputForm.php"; } else { echo $user->createUsersList($_GET['sort']);