diff --git a/NKUCodingCat/0024/0024.sql b/NKUCodingCat/0024/0024.sql deleted file mode 100644 index a07fa402..00000000 --- a/NKUCodingCat/0024/0024.sql +++ /dev/null @@ -1,67 +0,0 @@ -# SQL-Front 5.1 (Build 4.16) - -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE */; -/*!40101 SET SQL_MODE='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES */; -/*!40103 SET SQL_NOTES='ON' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS */; -/*!40014 SET FOREIGN_KEY_CHECKS=0 */; - - -# Host: localhost Database: 0024 -# ------------------------------------------------------ -# Server version 5.5.38 - -DROP DATABASE IF EXISTS `0024`; -CREATE DATABASE `0024` /*!40100 DEFAULT CHARACTER SET utf8 */; -USE `0024`; - -# -# Source for table code -# - -DROP TABLE IF EXISTS `code`; -CREATE TABLE `code` ( - `id` int(20) NOT NULL DEFAULT '0', - `to` text NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -# -# Dumping data for table code -# - -LOCK TABLES `code` WRITE; -/*!40000 ALTER TABLE `code` DISABLE KEYS */; -INSERT INTO `code` VALUES (13,'haiohpd'); -INSERT INTO `code` VALUES (14,'daduwwg'); -INSERT INTO `code` VALUES (9,'7'); -INSERT INTO `code` VALUES (11,'9'); -/*!40000 ALTER TABLE `code` ENABLE KEYS */; -UNLOCK TABLES; - -# -# Source for table max -# - -DROP TABLE IF EXISTS `max`; -CREATE TABLE `max` ( - `pro` varchar(255) DEFAULT NULL, - `max` int(11) NOT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -# -# Dumping data for table max -# - -LOCK TABLES `max` WRITE; -/*!40000 ALTER TABLE `max` DISABLE KEYS */; -INSERT INTO `max` VALUES ('max',15); -/*!40000 ALTER TABLE `max` ENABLE KEYS */; -UNLOCK TABLES; - -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; diff --git a/NKUCodingCat/0024/SQLIO.py b/NKUCodingCat/0024/SQLIO.py deleted file mode 100644 index 910189d9..00000000 --- a/NKUCodingCat/0024/SQLIO.py +++ /dev/null @@ -1,53 +0,0 @@ -#coding=utf-8 -import time, os, json, MySQLdb, HTMLParser, cgi -def SQL_init(): - db = MySQLdb.connect("127.0.0.1","root","root","0024" ) - return db.cursor() -def SQL_max(new=None): - cursor = SQL_init() - if new != None: - sql="""UPDATE `max` SET `max`=%d WHERE `pro`='max'"""%new - cursor.execute(sql) - return True - else: - sql="""SELECT * FROM `max` WHERE `pro`='max'""" - cursor.execute(sql) - max = cursor.fetchall()[0][1] - SQL_max(max+1) - return max -def SQL_in(task): - max = SQL_max() - cursor = SQL_init() - sql = """INSERT INTO `code` SET `id`=%d,`to`='%s';"""%(max, task) - cursor.execute(sql) - return True -def SQL_out(): - cursor = SQL_init() - sql = """SELECT * FROM `code`""" - cursor.execute(sql) - return cursor.fetchall() -def SQL_del(id): - cursor = SQL_init() - sql = """DELETE FROM `code` WHERE `id`=%d"""%id - cursor.execute(sql) - return json.dumps(cursor.fetchall()) -#----------- -Temp = """ - - %s - -
- -
- -""" - - -def PageMake(): - Data = SQL_out() - All = "" - Data = sorted(Data,key=lambda a:a[0] ) - for i in Data: - #print i - All+=Temp%(str(i[1]),int(i[0])) - return All \ No newline at end of file diff --git a/NKUCodingCat/0024/main.py b/NKUCodingCat/0024/main.py deleted file mode 100644 index ba03e834..00000000 --- a/NKUCodingCat/0024/main.py +++ /dev/null @@ -1,71 +0,0 @@ -#coding=utf-8 -const = """ - - - - - - - - -

TodoList应用演示

- -
- - - - - - - - {0} -
任务
管理
-
- - -
- - - - -""" - - -from bottle import static_file,route, run, post, request, redirect, error -import os, urllib,re,json,time -Root = os.path.split(os.path.realpath(__file__))[0]+"/static/" -import SQLIO - -@route('/todo') -def index(): - return const.format(SQLIO.PageMake(),) -@post('/todo') -def Accept(): - Req = request.body.read() - L = re.split("&",Req) - M = {} - for i in L: - A = re.split("=",i) - M[A[0]] = urllib.unquote(A[1]) - for j in M.keys(): - if re.findall("id-",j): - SQLIO.SQL_del(int(j[3:])) - redirect('/todo', 302) - try: - type = M["new"] - newtask = M["newtask"] - except: - redirect('/error', 404) - if newtask != "": - SQLIO.SQL_in(newtask) - redirect('/todo', 302) - else: - return "=.=所以你想添加什么任务呀" - -@route('/error') -def err(): - return "虽然不知道你在干什么但是触发了服务器错误呢" -@route('/static/') -def server_static(filename): - return static_file(filename, root=Root) -run(host='localhost',port=8080) \ No newline at end of file diff --git a/NKUCodingCat/0024/static/css.css b/NKUCodingCat/0024/static/css.css deleted file mode 100644 index da2076eb..00000000 --- a/NKUCodingCat/0024/static/css.css +++ /dev/null @@ -1 +0,0 @@ -h1{color:green;}table,th,td{border:1px solid blue;}table{border-collapse:collapse;width:100%;}th{height:50px;}td.task{width:70%;}input#delete{font-size:15px;color:blue;background-color:#FFFFFF;border-width:0;cursor:pointer;}textarea{vertical-align:middle;width:500px;height:100px;}input#submit{width:107px;height:42px;border-width:0;font-size:17px;font-weight:500;border-radius:6px;cursor:pointer;} \ No newline at end of file