|
|
@ -172,11 +172,14 @@ def image(): |
|
|
|
c = conn.cursor() |
|
|
|
filename = secure_filename(file.filename) |
|
|
|
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) |
|
|
|
c.execute("SELECT * FROM images WHERE filename=? AND user_id=?", (filename, current_user.get_user_dict()['dn'])) |
|
|
|
row = c.fetchone() |
|
|
|
|
|
|
|
c.execute("INSERT INTO images (filename, user_id) VALUES (?, ?)", (filename, current_user.get_user_dict()['dn'])) |
|
|
|
if row == None: |
|
|
|
c.execute("INSERT INTO images (filename, user_id) VALUES (?, ?)", (filename, current_user.get_user_dict()['dn'])) |
|
|
|
|
|
|
|
c.execute("SELECT * FROM images WHERE filename=?", (filename,)) |
|
|
|
row = c.fetchone() |
|
|
|
c.execute("SELECT * FROM images WHERE filename=? AND user_id=?", (filename, current_user.get_user_dict()['dn'])) |
|
|
|
row = c.fetchone() |
|
|
|
print(row[0]) |
|
|
|
conn.commit() |
|
|
|
conn.close() |
|
|
@ -237,10 +240,13 @@ def shorten_url(): |
|
|
|
c = conn.cursor() |
|
|
|
|
|
|
|
if url is not None and len(url) > 0: |
|
|
|
c.execute("INSERT INTO links (url, user_id) VALUES (?, ?)", (url, current_user.get_user_dict()['dn'])) |
|
|
|
|
|
|
|
c.execute("SELECT * FROM links WHERE url=?", (url,)) |
|
|
|
c.execute("SELECT * FROM links WHERE url=? AND user_id=?", (url, current_user.get_user_dict()['dn'])) |
|
|
|
row = c.fetchone() |
|
|
|
|
|
|
|
if row == None: |
|
|
|
c.execute("INSERT INTO links (url, user_id) VALUES (?, ?)", (url, current_user.get_user_dict()['dn'])) |
|
|
|
c.execute("SELECT * FROM links WHERE url=? AND user_id=?", (url, current_user.get_user_dict()['dn'])) |
|
|
|
row = c.fetchone() |
|
|
|
print(row[0]) |
|
|
|
conn.commit() |
|
|
|
conn.close() |
|
|
@ -260,10 +266,14 @@ def save_paste(): |
|
|
|
c = conn.cursor() |
|
|
|
|
|
|
|
if paste is not None and len(paste) > 0: |
|
|
|
c.execute("INSERT INTO pastes (paste, user_id) VALUES (?, ?)", (paste, current_user.get_user_dict()['dn'])) |
|
|
|
|
|
|
|
c.execute("SELECT * FROM pastes WHERE paste=?", (paste,)) |
|
|
|
c.execute("SELECT * FROM pastes WHERE paste=? AND user_id=?", (paste, current_user.get_user_dict()['dn'])) |
|
|
|
row = c.fetchone() |
|
|
|
|
|
|
|
if row == None: |
|
|
|
c.execute("INSERT INTO pastes (paste, user_id) VALUES (?, ?)", (paste, current_user.get_user_dict()['dn'])) |
|
|
|
|
|
|
|
c.execute("SELECT * FROM pastes WHERE paste=? AND user_id=?", (paste, current_user.get_user_dict()['dn'])) |
|
|
|
row = c.fetchone() |
|
|
|
print(row[0]) |
|
|
|
conn.commit() |
|
|
|
conn.close() |
|
|
|