Cannot register registered username

This commit is contained in:
Gregorio Chiko Putra 2017-09-06 15:04:41 +07:00
parent c43b4744db
commit b78a84585f
2 changed files with 10 additions and 1 deletions

View File

@ -71,6 +71,15 @@ class Home
$args['full_name'] = htmlspecialchars($args['full_name']);
$args['username'] = htmlspecialchars($args['username']);
$data = $this->access->showAll();
foreach ($data as $users) {
if ($args['username'] == $users['username']) {
Session::flash('info', 'Username already exists');
Redirect::to('./register');
die();
}
}
$this->access->entry($table, $args);
Redirect::to('/');

View File

@ -30,7 +30,7 @@ class Access extends \Core\Model
if ($stmt = $db->query($sql)) {
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
return true;
return $result;
}
return false;
} catch (PDOException $e) {