summaryrefslogtreecommitdiff
path: root/delete.py
blob: 7d80f347247c22c241639d4ff209e6eadaa3bcf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!D:/Programs/python3/python.exe
# -*- coding: utf-8 -*-
import cgi, cgitb
import pymysql
import sys, codecs
import configparser, codecs
import connect
from connect import Connect
import config
from config import Config
import path 
from path import Path

sys.stdout = codecs.getwriter('utf8')(sys.stdout.buffer)
print("Content-type:text/html\n")
form = cgi.FieldStorage()
w = form.getvalue('w')
if w == None: 
	print("Invalid whisper")
else: 
	db = Connect.produce()
	cursor = db.cursor() 
	query = "delete from whisper where id={0}".format(int(w))
	cursor.execute(query)
	db.commit() 
	cursor.close()
	db.close()
	_url = Config.get("route", "url")
	redirect = """
	<html>
	<head>        
	<meta http-equiv="refresh" content="0;url={0}/page.py">   
	</head>
	</html>
	""".format(_url)
	print(redirect)