import tkinter
from tkinter import *
import time
import datetime
from datetime import datetime
import os, sys
import hashlib
import mysql.connector
from threading import Thread
class Uygulama():
def __init__(self):
self.veritabani()
self.pencere = Tk()
self.pencere.title("SENDEKAZAN")
self.pencere.config(bg="black")
self.pencere.geometry("1250x650+0+0")
self.yanframe1 = Frame(self.pencere, width=300, height=650, bg="white")
self.girisyaptimi = 0
t1 = Thread(target=self.loginspanel)
t1.start()
self.t4 = Thread(target=self.onlinekisiler())
self.t4.start()
self.yanframe1.place(x=-300, y=0)
self.yanframe1ac = Button(self.pencere)
self.yanframe1ac.config(text=">", width=1, bg="red", fg="white", activebackground="white",
activeforeground="red", font=("Ubuntu", 12, "bold"),
command=lambda:self.yanframe1acfunc())
self.yanframe1ac.place(x=0, y=275)
self.pencere.mainloop()
def yanframe1acfunc(self):
i = -300
j = 0
while i <= 0:
while j <= 300:
self.yanframe1.place(x=i, y=0)
self.yanframe1ac.place(x=j, y=275)
self.pencere.update()
i += 5
j += 5
self.yanframe1ac.config(text="<", width=1, bg="red", fg="white", activebackground="white",
activeforeground="red", font=("Ubuntu", 12, "bold"),
command=lambda: self.yanframe1kapafunc())
self.pencere.update()
self.t4.start()
def yanframe1kapafunc(self):
i = 0
j = 300
while i >= -300:
while j >= 0:
self.yanframe1.place(x=i, y=0)
self.yanframe1ac.place(x=j, y=275)
self.pencere.update()
i -= 5
j -= 5
self.yanframe1ac.config(text=">", width=1, bg="red", fg="white", activebackground="white",
activeforeground="red", font=("Ubuntu", 12, "bold"),
command=lambda: self.yanframe1acfunc())
self.pencere.update()
# İşlem Ve Kontroller Bölümü
def loginspanel(self, kullaniciadi=None, loginsayi=None):
if self.girisyaptimi == 0:
# Yanframe1 in içinde bulunan login bölümü
self.yanfarem1icilogin = Frame(self.yanframe1, width=280, height=180, bg="black")
# -------------------------------------------------------------------------------------------------
# Kullanıcı Adı Bölümü
kullaniciadilabel = Label(self.yanfarem1icilogin, text="Kullanıcı Adı : ", bg="black", fg="white", font=("Ubuntu", 10, "bold"))
kullaniciadilabel.place(x=10, y=30)
self.kullaniciadientry = Entry(self.yanfarem1icilogin, bg="white", width=16, fg="black", font=("Ubuntu", 10, "bold"))
self.kullaniciadientry.place(x=114, y=30)
# -------------------------------------------------------------------------------------------------
# Kullanıcı Şifre Bölümü
kullanicisifrelabel = Label(self.yanfarem1icilogin, text="Kullanıcı Şifre : ", bg="black", fg="white",
font=("Ubuntu", 10, "bold"))
kullanicisifrelabel.place(x=10, y=55)
self.kullanicisifreentry = Entry(self.yanfarem1icilogin, show="*", width=16, bg="white", fg="black", font=("Ubuntu", 10, "bold"))
self.kullanicisifreentry.place(x=114, y=55)
# -------------------------------------------------------------------------------------------------
# Kullanici adi ve şifre hatasında çıkacak label
self.kullaniciadientryerror = Label(self.yanfarem1icilogin, text="×", bg="black", fg="red", font=("Ubuntu", 12, "bold"))
# self.kullaniciadientryerror.place(x=256, y=30)
self.kullanicisifreentryerror = Label(self.yanfarem1icilogin, text="×", bg="black", fg="red",
font=("Ubuntu", 12, "bold"))
# self.kullanicisifreentryerror.place(x=256, y=55)
# -------------------------------------------------------------------------------------------------
# Kullanici adi ve şifre onayında çıkacak label
self.kullaniciadientryokey = Label(self.yanfarem1icilogin, text="✓", bg="black", fg="green",
font=("Ubuntu", 12, "bold"))
# self.kullaniciadientryokey.place(x=256, y=30)
self.kullanicisifreentryokey = Label(self.yanfarem1icilogin, text="✓", bg="black", fg="green",
font=("Ubuntu", 12, "bold"))
# self.kullanicisifreentryokey.place(x=256, y=55)
# -------------------------------------------------------------------------------------------------
# Kullanıcı Login, Kayıt Ol, Şifremi Unuttum Button Bölümü
self.girisbtn = Button(self.yanfarem1icilogin, text="Giriş Yap", width=12, bg="red", fg="white", activebackground="white",
activeforeground="red", font=("Ubuntu", 10, "bold"),
command=lambda: self.giriscontrolpanel(self.kullaniciadientry.get(), self.kullanicisifreentry.get()))
self.girisbtn.place(x=10, y=90)
self.kayitbtn = Button(self.yanfarem1icilogin, text="Kayıt OL", width=13, bg="red", fg="white",
activebackground="white",
activeforeground="red", font=("Ubuntu", 10, "bold"),
command=lambda: self.kayitolframeacfunc())
self.kayitbtn.place(x=137, y=90)
self.sifrehatirlatbtn = Button(self.yanfarem1icilogin, text="Şifremi Hatırlat", width=29, bg="red", fg="white",
activebackground="white",
activeforeground="red", font=("Ubuntu", 10, "bold"),
command=lambda: self.sifrehatirlatframeacfunc())
self.sifrehatirlatbtn.place(x=10, y=130)
# -------------------------------------------------------------------------------------------------
self.yanfarem1icilogin.place(x=10,y=10)
# -------------------------------------------------------------------------------------------------
self.yanfarem1icilogin.update()
elif self.girisyaptimi == loginsayi:
# Yanframe1 in içinde bulunan login bölümü
self.yanfarem1icilogin2 = Frame(self.yanframe1, width=280, height=180, bg="black")
# -------------------------------------------------------------------------------------------------
# Durumu Güncelleme
self.dataislem.execute("UPDATE users SET user_durum = %s WHERE user_name = %s",(loginsayi,kullaniciadi))
self.data.commit()
# -------------------------------------------------------------------------------------------------
# Çıkış Yapma Butonu
self.sifrehatirlatbtn = Button(self.yanfarem1icilogin2, text="Çıkış Yap", width=29, bg="red",
fg="white",
activebackground="white",
activeforeground="red", font=("Ubuntu", 10, "bold"),
command=lambda: self.cikisyap(kullaniciadi))
self.sifrehatirlatbtn.place(x=10, y=130)
self.yanfarem1icilogin2.place(x=10, y=10)
# -------------------------------------------------------------------------------------------------
self.yanfarem1icilogin2.update()
def onlinekisiler(self):
onlinekisiler = Frame(self.yanframe1, width=280, height=446, bg="black")
baslik = Label(onlinekisiler, text="ONLINE KİŞİLER LİSTESİ", bg="black", fg="red", font=("Ubuntu", 13, "bold"))
baslik.place(x=30, y=10)
cizgi = Label(onlinekisiler, text="__________________________________________________", bg="black", fg="white", font=("Ubuntu", 9, "bold"))
cizgi.place(x=-3, y=30)
self.dataislem.execute("SELECT * FROM users WHERE user_durum = 1")
kullanicilar = self.dataislem.fetchall()
i = 50
for row in kullanicilar:
kullaniciadi = row['user_name']
kullaniciadilabel = Label(onlinekisiler, text=f"{kullaniciadi}", bg="black", fg="white")
kullaniciadilabel.place(x=0, y=i)
onlinekisiler.place(x=10, y=195)
def giriscontrolpanel(self, kullaniciadientry, kullanicisifreentry):
kullaniciadi = kullaniciadientry
kullanicisifre = kullanicisifreentry
if kullaniciadi:
self.kullaniciadientryerror.place_forget()
self.kullaniciadientryokey.place(x=256, y=30)
self.dataislem.execute(" SELECT * FROM users WHERE user_name='"+kullaniciadi+"' ")
kullanicisorgula = self.dataislem.fetchone()
if kullanicisorgula:
self.kullaniciadientryerror.place_forget()
self.kullaniciadientryokey.place(x=256, y=30)
if kullanicisifre:
self.kullanicisifreentryerror.place_forget()
self.kullanicisifreentryokey.place(x=256, y=55)
self.dataislem.execute(" SELECT * FROM users WHERE user_name='" + kullaniciadi + "' ")
kullanicisifresorgula = self.dataislem.fetchall()
for row in kullanicisifresorgula:
sifre = row['user_password']
if self.md5(kullanicisifre) == sifre:
self.kullanicisifreentryerror.place_forget()
self.kullanicisifreentryokey.place(x=256, y=55)
self.yanfarem1icilogin.destroy()
self.girisyaptimi = 1
t2 = Thread(target=self.loginspanel(kullaniciadi,self.girisyaptimi))
t2.start()
else:
self.kullanicisifreentryokey.place_forget()
self.kullanicisifreentryerror.place(x=256, y=55)
else:
self.kullanicisifreentryokey.place_forget()
self.kullanicisifreentryerror.place(x=256, y=55)
else:
self.kullaniciadientryokey.place_forget()
self.kullanicisifreentryokey.place_forget()
self.kullanicisifreentryerror.place_forget()
self.kullaniciadientryerror.place(x=256, y=30)
else:
self.kullaniciadientryokey.place_forget()
self.kullanicisifreentryokey.place_forget()
self.kullanicisifreentryerror.place_forget()
self.kullaniciadientryerror.place(x=256, y=30)
def cikisyap(self, kullaniciadi):
self.girisyaptimi = 0
# Durumu Güncelleme
self.dataislem.execute("UPDATE users SET user_durum = %s WHERE user_name = %s", (self.girisyaptimi, kullaniciadi))
self.data.commit()
# -------------------------------------------------------------------------------------------------
t3 = Thread(target=self.loginspanel())
t3.start()
def md5(self, sifre):
sifreolustur = hashlib.md5()
sifreolustur.update(sifre.encode("utf-8"))
cikti = sifreolustur.hexdigest()
return cikti
def veritabani(self):
self.data = mysql.connector.connect(
user="barron4335",
password="**************",
database="bcvcbots",
host="localhost"
)
self.dataislem = self.data.cursor(dictionary=True)
if __name__ == '__main__':
Uygulama()
Threadlarda sorun yaşamaktayım ve birde belirli sürelerde online kişileri yenileyememekteyim. Yardımcı olursanız sevinirim