Added register reason

master
spla 2 years ago
parent 7a3f26a263
commit 0b37d944bb

@ -150,7 +150,7 @@ if __name__ == '__main__':
db_user = spamcheck_db_user
table = "spamcheck"
sql = "create table "+table+" (created_at timestamptz, id bigint PRIMARY KEY, email varchar(200), ip inet)"
sql = "create table "+table+" (created_at timestamptz, id bigint PRIMARY KEY, email varchar(200), ip inet, text varchar(200))"
create_table(db, db_user, table, sql)
############################################################

@ -55,6 +55,8 @@ if __name__ == '__main__':
email_lst = []
ip_lst = []
text_lst = []
try:
@ -64,7 +66,7 @@ if __name__ == '__main__':
cur = conn.cursor()
cur.execute("select created_at, id, email, sign_up_ip from users where not approved;")
cur.execute("select users.created_at, users.id, users.email, users.sign_up_ip, user_invite_requests.text from users, user_invite_requests where not users.approved and users.id = user_invite_requests.user_id")
rows = cur.fetchall()
@ -80,6 +82,8 @@ if __name__ == '__main__':
ip_lst.append(row[3])
text_lst.append(row[4])
cur.close()
except (Exception, psycopg2.DatabaseError) as error:
@ -94,7 +98,7 @@ if __name__ == '__main__':
###############################################################################
insert_sql = 'INSERT INTO spamcheck(created_at, id, email, ip) VALUES(%s,%s,%s,%s) ON CONFLICT DO NOTHING'
insert_sql = 'INSERT INTO spamcheck(created_at, id, email, ip, text) VALUES(%s,%s,%s,%s,%s) ON CONFLICT DO NOTHING'
i = 0
@ -108,7 +112,7 @@ if __name__ == '__main__':
cur = conn.cursor()
cur.execute(insert_sql, (created_at_lst[i], id_lst[i], email_lst[i], ip_lst[i]))
cur.execute(insert_sql, (created_at_lst[i], id_lst[i], email_lst[i], ip_lst[i], text_lst[i]))
conn.commit()
@ -124,7 +128,7 @@ if __name__ == '__main__':
conn.close()
print(created_at_lst[i], id_lst[i], email_lst[i], ip_lst[i])
print(created_at_lst[i], id_lst[i], email_lst[i], ip_lst[i], text_lst[i])
i = i + 1

Loading…
Cancel
Save