Jump to content

menator01

New Members
  • Posts

    7
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

menator01's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. From code displayed, you are missing a closing " in $sql="select * from auth where user='.$uname'AND Pass='.$password.' limit 1; and your } in the if statement is in the wrong place
  2. Have a look at round() <?php $dec = 3.2569871; echo round($dec, 1); ?> will output 3.3
  3. My understanding of mvc model: handles all data such as get, add, and edit data. (From database or other form of data collection view: pretty much presentation. shows data retrieved controller: communicates between model and view. Model has no knowledge of view and vise versa controller is the go-between so to speak. controller has knowledge of both model and view. sometimes controller may contain some presentaion
  4. If there is interest in the thread I will write a full basic example using sqlite and a tkinter gui.
  5. How does one add a forum signature? I have looked in the user settings and can't seem to locate it.
  6. I realize this is an old topic but, wanted to reply. This is in no way a complete working script but, could do something like this. I would suggest using a database such as sqlite3 or mysql for storing user data or maybe a json file as it would make it easier. from string import ascii_letters, digits from random import sample characters = ascii_letters + digits + '@!?&#' def generate(): return ''.join(sample(characters, 10)) def check_newuser(new_user): if new_user: return True return False def check(username, password): # Do user validation stuff if username: return True return False main_menu = ['A: Login','B: Create Account','C: Quit'] print('What would you like to do?') while True: print(f"Options: {', '.join(main_menu)}") option = input('Choose an option\n>> ') if option.lower() not in ['a','b','c']: print('That is not a valid option.') if option.lower() == 'c': print('Goodbye!') break if option.lower() == 'a': username = input('Please enter your username\n>> ') password = input('Please enter your password\n>> ') validate = check(username, password) if validate: print(f'User {username} logged in') else: print('Sorry that username or password is not correct.') if option.lower() == 'b': new_user = input('Please enter a username\n>> ') check_user = check_newuser(new_user) if check_user: print('Options: 1 create own password, 2 generate random password') new_password_option = input('Choose an option\n>> ') if new_password_option == '1': newpass = input('Enter a new password\n>> ') elif new_password_option == '2': newpass = generate() else: print('That is not a valid option') print(f'Your password is {newpass}') else: print('That username has already been taken') # Go back and ask for new username
  7. Hello to everyone. Look forward to contributing to and learning from the community.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.