Koala
New Member
- May 23, 2017
- 22
- 2
Hello Devbest community,
I am here today to publish a development thread for my (hopefully last) Habbo related project. Flashback PHP is a Habbo Retro content-management system written in vanilla PHP. This means;
(not up yet, started this project 15 minutes ago. currently sitting in train)
Snippets
User.php, userLogin method
Oh yeah, and just a friendly reminder - I do not have too much experience in PHP, Python is my main skill set. Any tips / critique is more than welcome. End of the day, we are all learning new staff every day. Thank you.
I am here today to publish a development thread for my (hopefully last) Habbo related project. Flashback PHP is a Habbo Retro content-management system written in vanilla PHP. This means;
- No bulky template engines
- No frameworks like Laravel, Symphony etc..
- Core - DONE
- User class - Currently working on, register / login done so far
- Simple template handler (Most likely search -> replace -> render)
- Awesome visual look..
- PDO, prepared statements
- Output escaping
- Hashed passwords
- more?
(not up yet, started this project 15 minutes ago. currently sitting in train)
Snippets
User.php, userLogin method
PHP:
//existing user login validation
public function userLogin($username, $password) {
$this->username = $username;
$this->password = $password;
$this->query = 'SELECT * FROM users WHERE username=:username LIMIT 1';
$stmt = $this->connection->prepare($this->query);
$stmt->bindParam(':username', $this->username, PDO::PARAM_STR);
$stmt->execute();
$this->result = $stmt->fetch(PDO::FETCH_ASSOC);
if($stmt->rowCount() > 0) {
if(password_verify($this->password, $this->result['password'])) {
return true;
} else {
return false;
}
}
}
Post automatically merged:
Oh yeah, and just a friendly reminder - I do not have too much experience in PHP, Python is my main skill set. Any tips / critique is more than welcome. End of the day, we are all learning new staff every day. Thank you.
Last edited: