public function verifyDatabase() { $query = "SELECT id, avatar FROM users WHERE username = '******' AND password = '******'"; $result = \framework\system\Core::getInstance()->connection->query($query); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_assoc($result)) { $this->id = $row['id']; $this->avatar = $row['avatar']; } return true; } return false; }
public function valid_data() { if (empty($this->username)) { $this->errors[] = '"Username" field should be filled in!'; } if (empty($this->password)) { $this->errors[] = '"Password" field should be filled in!'; } $query = "SELECT id FROM users WHERE username='******'"; $result = \framework\system\Core::getInstance()->connection->query($query); if (mysql_num_rows($result)) { $this->errors[] = 'Username is already taken!'; } return count($this->errors) > 0 ? false : true; }
<?php // ╚═╚о╚└╦╚К└о╚▀ ═└О└╦▄═█Н ¤└л└╠┼мл╬┬... require_once __DIR__ . '/bootstrap.php'; // ╚═╚о╚└╦╚К└о╚▀ ▀─л└... require FRAMEWORK_ROOT_FOLDER . '/system/class.core.php'; \framework\system\Core::init();