-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
149 lines (124 loc) · 5.11 KB
/
main.py
File metadata and controls
149 lines (124 loc) · 5.11 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
import sys ; sys.dont_write_bytecode = True
from colorama import Fore , init ; init()
from os import getcwd , system , name
from time import sleep
import ctypes
import banner
#=========================================================================================
def clear():
if name == "nt":
system("cls")
else:
system("clear")
clear()
#=========================================================================================
def Sprint(text):
for character in text:
sys.stdout.write(character)
sys.stdout.flush()
sleep(0.3)
#=========================================================================================
path = getcwd()
test = ctypes.CDLL(f"{path}/data_base")
#=========================================================================================
RESET = (Fore.RESET)
#=========================================================================================
# Banner
banner.banner()
#=========================================================================================
try:
ask = input(f"{Fore.MAGENTA}Want to [F]ind User or [C]reate {Fore.GREEN}(F/C) : " + RESET)
except KeyboardInterrupt:
exit(f"""\n{Fore.YELLOW}│
╰┈➤{Fore.RED}[-]{Fore.BLUE} User Exited :)""")
if ask == "c" or ask == "C":
test.main()
#=========================================================================================
elif ask == "f" or ask == "F":
try:
file = open("User.txt" , "r")
except FileNotFoundError:
exit(Fore.RED + "you didnt create any users !".title() + RESET)
#=========================================================================================
U_name = input(Fore.MAGENTA + "\nEnter username : ".title() + RESET)
if U_name == "\n" or U_name == "":
exit(Fore.RED + "Username cant be empty !" + RESET)
else:
pass
#=========================================================================================
r_file = file.read()
#=========================================================================================
if f"Username : {U_name}" in r_file:
print(Fore.GREEN + "\nUser found" + RESET)
# find line
with open("User.txt") as myFile:
for num, line in enumerate(myFile, 1):
if U_name in line:
user_line = num # user_num has the line
else:
exit(Fore.RED + "\nuser not found".title() + RESET)
pwd = input(Fore.MAGENTA + "\nEnter User password : ".title() + RESET)
if pwd == "\n" or pwd == "":
exit(Fore.RED + "password cant be empty !" + RESET)
else:
pass
if f"Password : {pwd}" in r_file:
print(Fore.GREEN + "\nlogin succes".title() + RESET)
sleep(0.4)
print(Fore.YELLOW + "\nYou will redirect to User Pannel in 5 sec...".title() + RESET)
pass
else:
exit(Fore.RED + "\nlogin failure".title() + RESET)
# After login =========================================================================================
Sprint(Fore.LIGHTWHITE_EX + "\n1..2..3" + RESET)
clear()
banner.User_banner()
print(f"""\n{Fore.RED}[{Fore.GREEN}1{Fore.RED}] {Fore.LIGHTWHITE_EX}Edit user info {Fore.RED}[{Fore.GREEN}2{Fore.RED}]{Fore.LIGHTWHITE_EX} Remove user
{Fore.RED}[{Fore.GREEN}3{Fore.RED}] {Fore.LIGHTWHITE_EX}Improve rank {Fore.RED}[{Fore.GREEN}4{Fore.RED}] {Fore.LIGHTWHITE_EX}Improve rating
{Fore.RED}[{Fore.GREEN}5{Fore.RED}] {Fore.LIGHTWHITE_EX}Make draw
{Fore.RED}[{Fore.GREEN}0{Fore.RED}] {Fore.LIGHTWHITE_EX}Exit
""")
try:
choose = int(input(Fore.MAGENTA + "\nWhat do you want to do : " + RESET))
except KeyboardInterrupt:
exit(f"""\n{Fore.YELLOW}│
╰┈➤{Fore.RED}[-]{Fore.BLUE} User Exited :)""")
match(choose):
case 1:
print("""[1] Address [2] phone number""")
l = input("what do you want to change (will be complete...) : ")
if l == "1":
print(user_line)
u = user_line + 4
with open("User.txt" , "r") as edit:
read = edit.read()
edit.seek(u)
edit.write("hello" + read)
#FIXME
case 2:
with open("User.txt", "r+") as f:
d = f.readlines()
f.seek(0)
for i in d:
if i != "2 ":
f.write(i)
f.truncate()
exit("working...")
#FIXME
case 3:
exit("working...")
pass
case 4:
exit("working...")
pass
case 5:
exit("working...")
pass
case 0 :
exit(f"""{Fore.YELLOW}│
╰┈➤{Fore.RED}[-]{Fore.BLUE} User Exited :)""")
case _:
exit(f"""{Fore.YELLOW}│
╰┈➤{Fore.RED}[-]{Fore.BLUE} No Such Option !""")
#=========================================================================================
file.close()