Ejemplo n.º 1
0
 def Get_Text_Title_change(event):
     c = text_1.get('1.0', 'end-1c')
     f = text_2.get('1.0', 'end-1c')
     text_1.delete(1.0, END)
     text_2.delete(1.0, END)
     if (c != '') and (f != ''):
         db.Change_post_head(c, f)
         db_reader.index_maker('', 'site\\')
Ejemplo n.º 2
0
 def Get_Text_Post_add(event):
     c = text_1.get('1.0', 'end-1c')
     f = text_2.get('1.0', 'end-1c')
     g = entry_2.get()
     entry_2.delete(0, END)
     text_1.delete(1.0, END)
     text_2.delete(1.0, END)
     if (c != '') and (f != '') and (g != ''):
         db.Add_post(c, f, g)
         db_reader.index_maker('', 'site\\')
Ejemplo n.º 3
0
 def run(self):
     i = 0
     while i == 0:
         data = self.conn.recv(1024)
         udata = data.decode("utf-8")
         if udata == '1':
             self.conn.send(b'Enter post number you want to delete')
             data = self.conn.recv(1024)
             udata = data.decode("utf-8")
             db.Delete_post(udata)
             timer = str(time.asctime())
             print("["+str(timer)+"] " + str(self.addr) +
                   ' | Delete post number '+str(udata))
             db_reader.index_maker('', 'site\\')
         elif udata == '2':
             self.conn.send(b'Enter new title for site')
             data = self.conn.recv(1024)
             title = data.decode("utf-8")
             self.conn.send(b'1')
             data = self.conn.recv(1024)
             name = data.decode("utf-8")
             title_name_changer.Title_changer(title, name)
             timer = str(time.asctime())
             print("["+str(timer)+"] " + str(self.addr) +
                   ' | New title: '+str(title)+' , New name: '+str(name))
             db_reader.index_maker('', 'site\\')
         elif udata == '3':
             self.conn.send(b'Enter post title:')
             data = self.conn.recv(1024)
             title = data.decode("utf-8")
             self.conn.send(b'1')
             data = self.conn.recv(1024)
             body = data.decode("utf-8")
             db.Add_post(title, body, 123)
             timer = str(time.asctime())
             print ("["+str(timer)+"] " + str(self.addr) +
                    ' | New post: ' + str(title))
             db_reader.index_maker('', 'site\\')
         elif udata == '4':
             self.conn.send(b'Enter post title:')
             data = self.conn.recv(1024)
             ID_post = data.decode("utf-8")
             self.conn.send(b'1')
             data = self.conn.recv(1024)
             ID_comm = data.decode("utf-8")
             db.Del_comm(ID_post, ID_comm)
             db_reader.comm_adder(ID_post, 'site', '.')
             timer = str(time.asctime())
     self.conn.close()
Ejemplo n.º 4
0
import cgitb
import cgi
import os
import sys
from datetime import date
sys.path.insert(0, "..\DB")
import db_controller as db
sys.path.insert(0, "..")
import db_reader


cgitb.enable()
ip = db.Get_IP("..\\DB\\")
form = cgi.FieldStorage()
title = str(form.getvalue('post_name'))
body = str(form.getvalue("comment"))
today = str(date.today())
address = 'http://' + ip + ':14900/index.html'
address = '<meta http-equiv="refresh" content="0; url=%r"/>' % address
print(body)
if title == 'None' or body == 'None':
    print("Content-Type: text/html")
    print()
    print(address)
else:
    db.Add_post(title, body, 1, '..\\', '', '..\\DB\\')
    db_reader.index_maker('1', '', '..\\')
    print("Content-Type: text/html")
    print()
    print(address)
Ejemplo n.º 5
0
 def Get_Text_Post_delete(event):
     c = entry_1.get()
     entry_1.delete(0, END)
     if c != '':
         db.Delete_post(c)
         db_reader.index_maker('', 'site\\')