Esempio n. 1
0
def index():
    # histsimilar.data()
    #dict=data(f1)
    #histsimilar.list2('F:\\flask-file-upload-example-master\\uploads',histsimilar.data(filename))
    #similar()
    #dict=[{'imgurl':'../uploads/6f7088b4.jpg','title':'1aaa'},{'imgurl':'../uploads/7bf7191e.jpg','title':'2bbb'},{'imgurl':'../uploads/4b721df0.jpg','title':'s9999'}]
    #list()
    #init()
    #delete_test()
    #fetchall_test()
    #r=fetchall_test()
    ftext = open('iptest.txt').read()
    histsimilar.write('iptest.txt', ftext + ',' + request.remote_addr)
    if request.method == 'POST':
        file = request.files['file']
        #print lii.append({'imgurl':'','title':'','name':'12.jpg'})
        if file and allowed_file(file.filename):
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], "a.jpg"))
            return render_template(
                'index.html',
                dict=histsimilar.list2(
                    'F:\\flask-file-upload-example-master\\uploads'))
    return render_template(
        'index.html',
        dict=histsimilar.data(filename),
        user_ip=request.remote_addr)
Esempio n. 2
0
def loginup():
    if request.method == 'POST':
        return render_template(
            'index.html',
            dict=histsimilar.data(filename),
            username=client.selname(request.form['username'],
                                    request.form['password']),
            ipadd='/space?unicode=' + request.form['username'])
Esempio n. 3
0
def uploadtext():
    if request.method == 'POST':
        histsimilar.writecontent(request.form['content'])
        if request.args.get('i') is not None:
	   b=int(request.args.get('i'))
	   if len(histsimilar.writelist())/9+1==b:
	      return render_template('editor.html',content1=open('database/'+histsimilar.writelist()[int(request.args.get('i'))*9-9]).read(),content2=open('database/'+histsimilar.writelist()[int(request.args.get('i'))*9-8]).read(),content3=open('database/'+histsimilar.writelist()[int(request.args.get('i'))*9-7]).read(),content4=open('database/'+histsimilar.writelist()[int(request.args.get('i'))*9-6]).read(),content5=open('database/'+histsimilar.writelist()[int(request.args.get('i'))*9-5]).read(),content6=open('database/'+histsimilar.writelist()[int(request.args.get('i'))*9-4]).read(),content7=open('database/'+histsimilar.writelist()[int(request.args.get('i'))*9-3]).read(),content8=open('database/'+histsimilar.writelist()[int(request.args.get('i'))*9-2]).read(),content9=open('database/'+histsimilar.writelist()[int(request.args.get('i'))*9-1]).read())
           return render_template('editor.html',content1=open('database/'+histsimilar.writelist()[b*9-9]).read(),content2=open('database/'+histsimilar.writelist()[b*9-8]).read(),content3=open('database/'+histsimilar.writelist()[b*9-7]).read(),content4=open('database/'+histsimilar.writelist()[b*9-6]).read(),content5=open('database/'+histsimilar.writelist()[b*9-5]).read(),content6=open('database/'+histsimilar.writelist()[b*9-4]).read(),content7=open('database/'+histsimilar.writelist()[b*9-3]).read(),content8=open('database/'+histsimilar.writelist()[b*9-2]).read(),content9=open('database/'+histsimilar.writelist()[b*9-1]).read())
        return render_template('index.html',dict=histsimilar.data(filename))
Esempio n. 4
0
def replace(list):
    p=oldlines.index(eval(list[0])[0])
    oldlines[p]=histsimilar.data(filename2)[p]
    b=str(oldlines)	
    fp=open(filename,'w')
  #  for s in oldlines:
    fp.write(b)
    fp.close()
  #  newcase+=1
Esempio n. 5
0
def regisiterup():
    if request.method == 'POST':
        client.insertmes('(\'' + request.form['username'] + '\',\'' +
                         request.form['password'] + '\',\'' +
                         request.form['email'] + '\')')
        return render_template(
            'index.html',
            dict=histsimilar.data(filename),
            user_ip=request.remote_addr)
Esempio n. 6
0
def add_numbers():
    textreplace.replace(open('database/test1.txt').readlines())
    return render_template('index.html',dict=histsimilar.data(filename))
Esempio n. 7
0
app.config['UPLOADFILE_FOLDER'] = UPLOAD_FOLDER
app.config['STATIC_FOLDER'] = UPLOAD_FOLDER
path = r'testpic/TEST%d/%d.JPG'

DATABASE = 'sqldb.db' 
DEBUG = True
SECRET_KEY = 'development key'
USERNAME = '******'
PASSWORD = '******'
rootdir = 'F:\flask-file-upload-example-master\uploads' 
filename = "database/test.txt"
filename1 = "database/test1.txt"
filename2 = "database/test2.txt"
f1 = open("database/test1.txt")
fp=open('database/testtopic1.txt','w')
lii=histsimilar.data(filename)
#dict=[{'imgurl':'../uploads/6f7088b4.jpg','title':'1aaa'},{'imgurl':'../uploads/7bf7191e.jpg','title':'2bbb'},{'imgurl':'../uploads/4b721df0.jpg','title':'s9999'}]

app.config.from_object(__name__)
app.config.from_envvar('FLASKR_SETTINGS', silent=True)

def get_connection():
    db = getattr(g, '_db', None)
    if db is None:
        db = g._db = connect_db()
    return db
def get_conn(path):
   
    conn = sqlite3.connect(path)
    if os.path.exists(path) and os.path.isfile(path):
        print('s:[{}]'.format(path))
Esempio n. 8
0
import os
import re
import histsimilar
filename='database/test.txt'
filename2='database/test2.txt'
oldlines=histsimilar.data(filename)
def replace(list):
    p=oldlines.index(eval(list[0])[0])
    oldlines[p]=histsimilar.data(filename2)[p]
    b=str(oldlines)	
    fp=open(filename,'w')
  #  for s in oldlines:
    fp.write(b)
    fp.close()
  #  newcase+=1