(Python code)
from tkinter import *
from tkinter import messagebox
import tkinter.messagebox
import os
import time
import tkinter as tk
from tkinter import ttk
import webbrowser
from tkinter import *
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib
creds = 'tempfile.temp' # This just sets the variable creds to 'tempfile.temp'
def Signup(): # This is the signup definition,
global pwordE # These globals just make the variables global to the entire script, meaning any definition can use them
global nameE
global roots
roots = Tk() # This creates the window, just a blank one.
roots.title('Signup') # This renames the title of said window to 'signup'
intruction = Label(roots, text='Please Enter new Credidentials\n') # This puts a label, so just a piece of text saying 'please enter blah'
intruction.grid(row=0, column=0, sticky=E) # This just puts it in the window, on row 0, col 0. If you want to learn more look up a tkinter tutorial :)
nameL = Label(roots, text='New Username: ') # This just does the same as above, instead with the text new username.
pwordL = Label(roots, text='New Password: ') # ^^
nameL.grid(row=1, column=0, sticky=W) # Same thing as the instruction var just on different rows. :) Tkinter is like that.
pwordL.grid(row=2, column=0, sticky=W) # ^^
nameE = Entry(roots) # This now puts a text box waiting for input.
pwordE = Entry(roots, show='*') # Same as above, yet 'show="*"' What this does is replace the text with *, like a password box :D
nameE.grid(row=1, column=1) # You know what this does now :D
pwordE.grid(row=2, column=1) # ^^
signupButton = Button(roots, text='Signup', command=FSSignup) # This creates the button with the text 'signup', when you click it, the command 'fssignup' will run. which is the def
signupButton.grid(columnspan=2, sticky=W)
roots.mainloop() # This just makes the window keep open, we will destroy it soon
def FSSignup():
with open(creds, 'w') as f: # Creates a document using the variable we made at the top.
f.write(nameE.get()) # nameE is the variable we were storing the input to. Tkinter makes us use .get() to get the actual string.
f.write('\n') # Splits the line so both variables are on different lines.
f.write(pwordE.get()) # Same as nameE just with pword var
f.close() # Closes the file
roots.destroy() # This will destroy the signup window. :)
Login() # This will move us onto the login definition :D
def Login():
global nameEL
global pwordEL # More globals :D
global rootA
rootA = Tk() # This now makes a new window.
rootA.title('Login') # This makes the window title 'login'
intruction = Label(rootA, text='Please Login\n') # More labels to tell us what they do
intruction.grid(sticky=E) # Blahdy Blah
nameL = Label(rootA, text='Username: ') # More labels
pwordL = Label(rootA, text='Password: ') # ^
nameL.grid(row=1, sticky=W)
pwordL.grid(row=2, sticky=W)
nameEL = Entry(rootA) # The entry input
pwordEL = Entry(rootA, show='*')
nameEL.grid(row=1, column=1)
pwordEL.grid(row=2, column=1)
loginB = Button(rootA, text='Login', command=CheckLogin) # This makes the login button, which will go to the CheckLogin def.
loginB.grid(columnspan=2, sticky=W)
rootA.mainloop()
def callback():
webbrowser.open_new(r"https://horizonentertainme06.wixsite.com/horizonentertainment")
def CheckLogin():
with open(creds) as f:
data = f.readlines() # This takes the entire document we put the info into and puts it into the data variable
uname = data[0].rstrip() # Data[0], 0 is the first line, 1 is the second and so on.
pword = data[1].rstrip() # Using .rstrip() will remove the \n (new line) word from before when we input it
if nameEL.get() == uname and pwordEL.get() == pword:
tkinter.messagebox.showinfo("Login Successful", "You have successfully logged in!")
root = Tk()
root.geometry('1500x900')
root.configure(background='#2B2B2B')
root.title('Horizon Admin Panel')
Label(root, text='Welcome to the HORIZON Staff Dashboard!', bg='#2B2B2B', fg='#f1c40f', font=('arial', 30, 'normal')).place(x=4, y=0)
help2 = Button(root, text='Support', bg='#f1c40f', font=('arial', 30, 'normal'),command=support)
apptray = Button(root, text='App tray', bg='#f1c40f', font=('arial', 30, 'normal'), command=apps).place(x=30, y=200)
web = Button(root, text = "Website",command=openweb)
root.mainloop()
else:
tkinter.messagebox.showerror(title="ERROR LOGGING IN", message="Incorrect Password/Username! Try Again!")
def apps():
root = Tk()
root.geometry('1080x913')
root.configure(background='#1e272e')
root.title('HORIZON emails')
send = Button(root, text='Send Mail', bg='#f1c40f', font=('arial', 30, 'normal'), command=sendmail).place(x=30, y=100)
Label(root, text='HORIZON APP TRAY', bg='#1e272e', fg='#f1c40f', font=('arial', 30, 'normal')).place(x=400, y=0)
send = Button(root, text='Support Server', bg='#f1c40f', font=('arial', 30, 'normal'), command=supportsend).place(x=30, y=200)
link = Button(root, text='Dev-Utilities', bg='#f1c40f', font=('arial', 30, 'normal'), command=helpfullinks).place(x=30, y=300)
root.mainloop()
def openweb():
webbrowser.open_new(r"https://horizonentertainme06.wixsite.com/horizonentertainment")
def helpfullinks():
webbrowser.open_new(r"https://h0riz0nentertainment.wixsite.com/horizonentertainment/dev-utilities")
def sendmail():
webbrowser.open_new(r"https://mail.google.com/mail/u/0/#inbox?compose=new")
def supportsend():
webbrowser.open_new(r"https://discord.gg/3PS9mQp")
def support():
root = Tk()
root.geometry('780x513')
root.configure(background='#2B2B2B')
root.title('HORIZON App Tray')
Label(root, text='HORIZON APP TRAY', bg='#2B2B2B', fg='#f1c40f', font=('arial', 30, 'normal')).place(x=400, y=0)
send = Button(root, text='Support Server', bg='#f1c40f', font=('arial', 20, 'normal'), command=supportsend).place(x=30, y=200)
root.mainloop()
def DelUser():
os.remove(creds) # Removes the file
rootA.destroy() # Destroys the login window
Signup() # And goes back to the start!
if os.path.isfile(creds):
Login()
else: # This if else statement checks to see if the file exists. If it does it will go to Login, if not it will go to Signup :)
Signup()