diff options
author | Kyle McFarland <tfkyle@gmail.com> | 2018-01-31 00:51:07 -0600 |
---|---|---|
committer | Kyle McFarland <tfkyle@gmail.com> | 2018-01-31 00:51:07 -0600 |
commit | 61d1aa04d8d44b17bfe6dace90088669fc6c3df8 (patch) | |
tree | 7ede15c880e4c41a18cded46fe6d03fb2dc4543b /common/tables/members.php | |
download | mcoop-61d1aa04d8d44b17bfe6dace90088669fc6c3df8.zip mcoop-61d1aa04d8d44b17bfe6dace90088669fc6c3df8.tar.gz mcoop-61d1aa04d8d44b17bfe6dace90088669fc6c3df8.tar.bz2 |
* Registration system's almost done
* Just part way through implementing tasks
So not much done yet, but it's a start.
Diffstat (limited to 'common/tables/members.php')
-rw-r--r-- | common/tables/members.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/common/tables/members.php b/common/tables/members.php new file mode 100644 index 0000000..bf1240d --- /dev/null +++ b/common/tables/members.php @@ -0,0 +1,47 @@ +<?php +namespace mcoop; +require_once("common/db_classes.php"); + +class MembersUpgrader extends BaseIncrementalTableUpgrader { + function from_1_to_2() { + //$this->conn->exec("ALTER TABLE members ADD COLUMN (test BOOL)"); + // No actual changes in this one, it was just to make sure the upgrader paths were working + } + + function __construct($conn) { + $this->conn = $conn; + $this->table_name = "members"; + $this->upgrade_method_names[2] = "from_1_to_2"; + } +} + +$members_table_decl = new SimpleTableDecl( + "members", + array( + "register_member" => "INSERT INTO members (username, email, last_updated_table_version, full_name, argon2_password_hash) VALUES (:username, :email, :version, :full_name, :argon2_phash)", + "get_member_passhash_by_username" => "SELECT argon2_password_hash FROM members WHERE username = :username", + "get_member_by_username" => "SELECT * FROM members WHERE username = ?", + "get_member_by_email" => "SELECT * FROM members WHERE email = ?", + "get_members_by_uname_or_email" => "SELECT * FROM members WHERE username = :username OR email = :email", + "get_public_member_info_by_userid" => "SELECT userid, username, full_name FROM members WHERE userid=:userid" + ), + "CREATE TABLE `members` ( +`userid` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +`username` TEXT CHARACTER SET utf8 NOT NULL, +`email` TEXT CHARACTER SET utf8 NOT NULL, +`last_updated_table_version` INT NOT NULL, +`full_name` TEXT CHARACTER SET utf8, +`validation_code` CHAR(64) CHARACTER SET ascii, +`validated` BOOL DEFAULT false, +`full_member` BOOL DEFAULT false, +`argon2_password_hash` VARCHAR(256) CHARACTER SET ascii, +`reset_password_hash` VARCHAR(256) CHARACTER SET ascii, +`reset_requested` BOOL DEFAULT false, +UNIQUE KEY (`username`(256)), +UNIQUE KEY (`email`(256)) +);", + 2, + "\mcoop\MembersUpgrader" +); + +?> |