From c0aa8c09f46ddeeb164d7f1fd760ddbe0c573d1a Mon Sep 17 00:00:00 2001 From: Aaron Johnson Date: Wed, 23 Mar 2022 07:26:05 -0500 Subject: [PATCH] Various updates --- changeAdminPass.txt | 3 ++- index.php | 18 +++++++++--------- notes.txt | 22 ++++++++++++++++++++++ 3 files changed, 33 insertions(+), 10 deletions(-) mode change 100644 => 100755 index.php create mode 100644 notes.txt diff --git a/changeAdminPass.txt b/changeAdminPass.txt index cc8f476..442d72e 100644 --- a/changeAdminPass.txt +++ b/changeAdminPass.txt @@ -1 +1,2 @@ -update password_delivery set key = md5('your new password') where id = 0; +insert into mypasswd.password_delivery (code) values MD5('1234'); +update password_delivery set code = md5('your new password') where id = 0; diff --git a/index.php b/index.php old mode 100644 new mode 100755 index b68fa5d..0034328 --- a/index.php +++ b/index.php @@ -17,18 +17,18 @@
'; } else{ - + $MyPassword = pg_fetch_result($MyLookup,0,0); $MyIP = $_SERVER['REMOTE_ADDR']; - $MyLookup = pg_query($DBConnection, "UPDATE password_delivery + $MyLookup = pg_query($DBConnection, "UPDATE mypasswd.password_delivery SET retrieved_ip = '".pg_escape_string($MyIP)."', retrieved_time = 'now()', password = '' - WHERE key = '".pg_escape_string($MyKey)."'"); + WHERE code = '".pg_escape_string($MyKey)."'"); print '

Your password is:

'; @@ -57,7 +57,7 @@ print '

'.$MyPassword.'

'; - } else { + } else { print ''.$MyPassword.'

'; } print '

Do not hit reload on your browser. This URL is one-time use and will not show your passsword again.

'; diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..536cecf --- /dev/null +++ b/notes.txt @@ -0,0 +1,22 @@ +# Create MySQL tables: +CREATE TABLE pwtool.mypasswd ( + password VARCHAR(256) NULL, + `code` varchar(32) NOT NULL, + retrieved_ip varchar(39) NULL, + retireved_time TIMESTAMP NULL, + id BIGINT UNSIGNED auto_increment NOT NULL, + CONSTRAINT mypasswd_PK PRIMARY KEY (id) +) +ENGINE=InnoDB +DEFAULT CHARSET=utf8mb4 +COLLATE=utf8mb4_bin; +CREATE INDEX mypasswd_id_IDX USING BTREE ON pwtool.mypasswd (id); + + +# create user: +CREATE USER 'pwtool'@'%'; +ALTER USER 'pwtool'@'%' +IDENTIFIED BY 'BaVYtU9YqMyrp4qi' ; +GRANT Insert ON pwtool.mypasswd TO 'pwtool'@'%'; +GRANT Select ON pwtool.mypasswd TO 'pwtool'@'%'; +GRANT Update ON pwtool.mypasswd TO 'pwtool'@'%';