Skip to content

Instantly share code, notes, and snippets.

@waltertschwe
Created June 4, 2018 22:24
Show Gist options
  • Select an option

  • Save waltertschwe/26dd65fc6d4e1ef534dd3c6f6d53aed4 to your computer and use it in GitHub Desktop.

Select an option

Save waltertschwe/26dd65fc6d4e1ef534dd3c6f6d53aed4 to your computer and use it in GitHub Desktop.
<?php
class Registration
{
function __construct($user, $password) {
$this->user = $user;
// salt should be stored in .env file
$this->password = crypt($password, '$2a$09$tdfndZfdksdddf$');
}
function registerUser() {
// stubbed save function that would talk to your data storage ( mysql, mongodb, etc)
$this->save($this->user, $this->password);
}
}
(isset($_POST['user'])) ? $user = $_POST['user'] : $user = "[email protected]";
(isset($_POST['pass'])) ? $password = $_POST['password'] : $password = "%ZZprxt5";
$register = new Registration($user, $password);
$register->registerUser();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment