From 61d1aa04d8d44b17bfe6dace90088669fc6c3df8 Mon Sep 17 00:00:00 2001 From: Kyle McFarland Date: Wed, 31 Jan 2018 00:51:07 -0600 Subject: Initial import * Registration system's almost done * Just part way through implementing tasks So not much done yet, but it's a start. --- common/tables/members.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 common/tables/members.php (limited to 'common/tables/members.php') 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 @@ +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" +); + +?> -- cgit v1.1