Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import os
- import time
- from pathlib import Path
- my_file = Path("database.txt")
- if my_file.is_file():
- f= open("database.txt","r+")
- infilename = "database.txt"
- with open(infilename, "r") as f:
- line_list = f.readlines()
- # f = f.readlines()
- f.close()
- found = False
- f= open("database.txt","r+")
- for line in f:
- if str("users") in line:
- print ("Found it")
- print ("Beginning database edit/user add")
- print ("You will be requested for input soon")
- usernamenew = input("New DB username: ")
- passwordnew = input("New DB password: ")
- f.close
- f= open("database.txt","a+")
- f.write("UN:",usernamenew)
- f.write("UP:",passwordnew)
- found = True
- if not found:
- f = open('database.txt', 'a')
- f.write(str("NUN: root 1")+"n")
- f.close()
- print("nCreating database")
- time.sleep(3)
- print(".")
- time.sleep(1)
- print("..")
- time.sleep(1)
- print("...")
- time.sleep(1)
- print(".")
- time.sleep(1)
- time.sleep(5)
- print("nCreating user")
- print(".")
- time.sleep(1)
- print("..")
- time.sleep(1)
- print("...")
- time.sleep(1)
- print(".")
- time.sleep(6)
- confirm = input("nAre you sure you wish to write changes? Y/N: ")
- if confirm == str("Y") or str("y"):
- print("nWriting changes NOW")
- f= open("database.txt","w+")
- f.close
- for i in range(1):
- f= open("database.txt","a+")
- f.write("users rn")
- f.write("NUN: root %drn" % (i+1))
- f.write("NUP: root %drn" % (i+1))
- f.close
- for i in range(1):
- f= open("database.txt","w+")
- f.write("users rn")
- f.write("NUN: root %drn" % (i+1))
- f.write("NUP: root %drn" % (i+1))
- f.close
- else:
- print("You have aborted the database creation")
- print("The following script may not run. This is due to no/invalid database installation")
- my_file = Path("database.txt")
- if my_file.is_file():
- f= open("database.txt","r+")
- infilename = "database.txt"
- with open(infilename, "r") as f:
- line_list = f.readlines()
- # f = f.readlines()
- f.close()
- found = False
- f= open("database.txt","r+")
- for line in f:
- if str("users") in line:
- print ("Found it")
- print ("Beginning database edit/user add")
- print ("You will be requested for input soon")
- usernamenew = input("New DB username: ")
- passwordnew = input("New DB password: ")
- f.close
- f= open("database.txt","a+")
- f.write("UN:",usernamenew)
- f.write("UP:",passwordnew)
- found = True
- if not found:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement