Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import time
- option = ''
- def register():
- username = input("What would you like your username to be?")
- password = input("What would you like your password to be?")
- file = open("logins.txt","a")
- file.write(username)
- file.write(" ")
- file.write(password)
- file.write(" ")
- file.write("\n")
- file.close()
- def login():
- username = input("What is your username?")
- password = input("What is your password?")
- if username in open('logins.txt').read() and password in open('logins.txt').read():
- print("Login Correct, Welcome ",username)
- signedin = "yes"
- def msg():
- message = input("What is your message?")
- recipient = input("What is the person's username you are sending it to")
- file = open("messages.txt","a")
- file.write(message)
- file.write(" ")
- file.write("To")
- file.write(" ")
- file.write(recipient)
- file.write(" ")
- file.write("From")
- file.write(username)
- file.write(" ")
- file.write("\n")
- file.close()
- print("Welcome to CryptChat Your options are below: ")
- print("Register")
- print("Login")
- print("Message (Login first)")
- print("Type 'exit' to quit")
- while option != 'exit':
- option = input("Please select one of the options: ")
- file = open("logins.txt","a")
- signedin = "no"
- if option.lower() == "register":
- register()
- if option.lower() == "login":
- login()
- if option.lower() == "Message" and signedin == "yes":
- msg()
- elif option.lower() =="message" and signedin =="no":
- print("you are not able to send a message unless\n you login first")
- print("you will be redirected to Login page in 5 seconds")
- time.sleep(5)
- print( os.system("CLS"),chr(13)," ",chr(13))
- login()
- print( os.system("CLS"),chr(13)," ",chr(13))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement