-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathkernel.py
More file actions
157 lines (156 loc) · 5.52 KB
/
Copy pathkernel.py
File metadata and controls
157 lines (156 loc) · 5.52 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#Mint Kernel File v1.1
import sqlite3
from hashing import Hashing
from history import History
from datetime import datetime
import os
VERSION="1.0.6_hist"
class Kernel:
def __init__(self):
#print("Mint Engine")
self.conn =sqlite3.connect('database'+os.sep+'users.sql', check_same_thread=False)
self.cursor = self.conn.cursor()
def version(self):
global VERSION
return VERSION
def checkuser(self,username,password):
hasher=Hashing()
sqlstr='select * from users'
self.cur=self.conn.execute(sqlstr)
rows=self.cur.fetchall()
cor=False
for row in rows:
if hasher.check(password,row[1]) and username == row[0]:
cor=True
return [True,row]
#else:
#pass
if not cor:
return [False]
def chkrole(self,user,role):
hasher=Hashing()
sqlstr='select * from users'
self.cur=self.conn.execute(sqlstr)
rows=self.cur.fetchall()
cor=False
for row in rows:
if user == row[0] and role == row[2]:
cor=True
return True
if not cor:
return False
def addmoney(self,childname,addper,role,adder,note):
#FORCE CHECK
year = datetime.now().strftime('%Y')
month = datetime.now().strftime('%m')
date = datetime.now().strftime('%d')
ro=self.chkrole(addper,'adult')
#r1=self.checkuser(adder,adultpassword)
if ro:# and r1:
role = True
else:
role=False
a = True
if a:
if role:
child=childname
sqlstr='select * from users'
cur=self.conn.execute(sqlstr)
rows=cur.fetchall()
nowdollar="D"
for row in rows:
# print('RAN USER='+session['user'])
if row[0] == child and row[2]=="child":
#print(row[3])
#print("--------")
nowdollar=row[3]
#print(nowdollar)
if nowdollar == "D":
return "0x0002"
else:
child=childname
cm=nowdollar
#return redirect(url_for("add_now"))
#Add Money
cmd='UPDATE users SET "Money" = "'+str(int(nowdollar)+int(adder))+'" WHERE Name="'+child+'"'
curs = self.conn.cursor()
curs.execute(cmd)
self.conn.commit()
history=History()
history.makehistory("+",year,month,date,str(int(adder)),note,addper,child,str(int(nowdollar)+int(adder)))
else:
return "0x0001"
#0x0001 = Adult Username ,PW or Role Incorrect #0x0002=Child Username,Role Incorrect
def removemoney(self,childname,addult,role,adder,notes):
role=self.chkrole(addult,'adult')
#r1=self.checkuser(adder,adderpw)
#r2=self.checkuser(childname,childpw)
year = datetime.now().strftime('%Y')
month = datetime.now().strftime('%m')
date = datetime.now().strftime('%d')
if role: #and r1 and r2:
role=True
else:
role=False
add = True
if add:
if role:
child=childname
sqlstr='select * from users'
cur=self.conn.execute(sqlstr)
rows=cur.fetchall()
nowdollar="D"
for row in rows:
# print('RAN USER='+session['user'])
if row[0] == child and row[2]=="child":
#print(row[3])
#print("--------")
nowdollar=row[3]
#print(nowdollar)
if nowdollar == "D":
return "0x0002"
else:
#addmoney1=money
#add=int(addmoney1)
child=childname
cm=nowdollar
#return redirect(url_for("add_now"))
#Add Money
cmd='UPDATE users SET "Money" = "'+str(int(nowdollar)-int(adder))+'" WHERE Name="'+child+'"'
curs = self.conn.cursor()
curs.execute(cmd)
self.conn.commit()
history=History()
history.makehistory("-",year,month,date,str(int(adder)),notes,addult,child,str(int(nowdollar)-int(adder)))
return "OK"
else:
return "0x0003"
#0x0003=IS NOT ADULT
def getmoney(self,user):
nowdollar="D"
child=user
sqlstr='select * from users'
cur=self.conn.execute(sqlstr)
rows=cur.fetchall()
for row in rows:
# print('RAN USER='+session['user'])
if row[0] == child and row[2]=="child":
#print(row[3])
#print("--------")
nowdollar=row[3]
#print(nowdollar)
if nowdollar == "D":
return "D"
else:
return nowdollar
def isreal(self):
return True
def isnew(self):
stmt = """SELECT count(*) FROM sqlite_master WHERE type='table' AND name='users';"""
cur=self.conn.execute(stmt)
result = cur.fetchone()
return result
"""
Meow Tech Mint - Kernel For The Central System
Central System Has Been Modified To Use The Mint Core.
"""