-
Posts
7 -
Joined
-
Last visited
Posts posted by menator01
-
-
Have a look at round()
<?php $dec = 3.2569871; echo round($dec, 1); ?> will output 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
-
Ok thanks to both
-
If there is interest in the thread I will write a full basic example using sqlite and a tkinter gui.
-
How does one add a forum signature? I have looked in the user settings and can't seem to locate it.
-
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
-
Hello to everyone. Look forward to contributing to and learning from the community.
Syntax Error unexepected $end
in PHP Coding Help
Posted
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