Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
[PY] On Button
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Sway" data-source="post: 225727" data-attributes="member: 1889"><p>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. </p><p> </p><p>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.</p><p> </p><p>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.</p><p> </p><p><strong>Source:</strong></p><p><a href="http://pastebin.com/MtqWxsU5" target="_blank">http://pastebin.com/MtqWxsU5</a></p><p> </p><p>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.</p><p> </p><p><strong>Stuffs needed: </strong></p><p><strong>** </strong><a href="http://bottlepy.org" target="_blank">Bottle </a>(0.11) framework.</p><p>** <a href="http://sourceforge.net/projects/mysql-python/" target="_blank">MySQLdb</a> module for Python 2.4-2.7.</p><p>** <a href="http://www.python.org/download/releases/2.7/" target="_blank">Python 2.7</a></p><p> </p><p><strong>Snippet:</strong></p><p>[CODE]@post('/menu')</p><p>def menu():</p><p> db = MySQLdb.connect(host='localhost', port=3306, user="root", passwd="XefraDef4s", db="a101")</p><p> query = db.cursor()</p><p> </p><p> user = request.forms.get('username')</p><p> passw = request.forms.get('password')</p><p> passw2 = str(passw)</p><p> password = hashlib.md5(passw2).hexdigest()</p><p> rank = int(7)</p><p> </p><p> ugh = query.execute("SELECT * FROM users WHERE username = '%s' AND password = '%s' AND rank >= '%s'" % (user, password, rank))</p><p> </p><p> if ugh:</p><p> db.commit()</p><p> return panel1()</p><p> else:</p><p> return 'failure'[/CODE]</p><p> </p><p>Thanks<strong>.</strong></p></blockquote><p></p>
[QUOTE="Sway, post: 225727, member: 1889"] 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. [B]Source:[/B] [URL]http://pastebin.com/MtqWxsU5[/URL] 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. [B]Stuffs needed: [/B] [B]** [/B][URL='http://bottlepy.org']Bottle [/URL](0.11) framework. ** [URL='http://sourceforge.net/projects/mysql-python/']MySQLdb[/URL] module for Python 2.4-2.7. ** [URL='http://www.python.org/download/releases/2.7/']Python 2.7[/URL] [B]Snippet:[/B] [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'[/CODE] Thanks[B].[/B] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
[PY] On Button
Top