Show DevBest [PY] On Button

Sway

Ruby and Python are married.
Dec 19, 2010
194
76
I have gotten way too interested in web development using Python. Below is the link to the source code of a small web application I created.

It is a button that allows you to run any application of your choice (aslong as it is hard coded inside). Before you can do that, you will have to login to get to the button. It reads from a database that uses MySQL.

It was initially created for a Habbo retro to turn on an emulator through this application, so it reads from a table called "users" and stuffs like that.. but you can edit it with ease.

Source:


Please give me any suggestions or improvements I can make to this. If you have any questions on how to use this or set it up, feel free to ask me.

Stuffs needed:
** (0.11) framework.
** module for Python 2.4-2.7.
**

Snippet:
Code:
@post('/menu')
def menu():
    db = MySQLdb.connect(host='localhost', port=3306, user="root", passwd="XefraDef4s", db="a101")
    query = db.cursor()
 
    user = request.forms.get('username')
    passw = request.forms.get('password')
    passw2 = str(passw)
    password = hashlib.md5(passw2).hexdigest()
    rank = int(7)
 
    ugh = query.execute("SELECT * FROM users WHERE username = '%s' AND password = '%s' AND rank >= '%s'" % (user, password, rank))
   
    if ugh:
        db.commit()
        return panel1()
    else:
        return 'failure'

Thanks.
 

Users who are viewing this thread

Top