I am trying to make a chat system. What I need is python code that checks for a correct username and password or if it even exists in the phpmyadmin database. If the username and password is entered wrong then it would restart the script
and you would need to enter the password and username again.
This is what I have tried so far.
UsernameInput = input ("UsernameInput",)
PasswordInput = input ("PasswordInput",)
WrongUsername = ("Wrong Username")
WrongPassword = ("Wrong Password")
if(UsernameInput == "username" and PasswordInput == "password"):
print("Loged in sucsessfully")
WAMP is not a server but W-indows A-pache M-ySQL P-HP.
Apache is Web Server and
MySQL is Database Server.
phpMyAdmin is only tool to manage
Apache needs module
mod_WSGI if you want to use Python to create web page in place of PHP.
Python needs module like
MySQLdb to get access to
MySQL and check username and login.
BTW: user lowercase for variable names and functions names
logged_in = False while not logged_in: username_input = input("UsernameInput") # no need , password_input = input("PasswordInput") # no need , wrong_username = "Wrong Username" # no need () wrong_password = "Wrong Password" # no need () if username_input == "username" and password_input == "password": # no need () print("Loged in sucsessfully") logged_in = True else: print("login failled - try again") print( "You are inside the program - do what you want" )