Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #--*--coding: utf-8--*--
- import cgi
- import MySQLdb
- import user
- from dbconfig import read_param, game_server
- from premium_user import isPremiumUser
- status, username = user.isAuth()
- premium_account = isPremiumUser()
- form = cgi.FieldStorage()
- if form.getvalue("char_select"):
- player = form.getvalue("char_select")
- dict_with_all_good_items = {57:"Adena", 5:"DC gloves", 8:"DC helmet"}
- all_good_items = set()
- for i in dict_with_all_good_items.keys():
- all_good_items.add(i)
- if status:
- if premium_account:
- db_config = game_server()
- db = MySQLdb.connect(**db_config)
- cursor = db.cursor()
- cursor.execute("SELECT charId FROM characters WHERE char_name=%s", (player))
- owner = cursor.fetchone()
- owner = int(owner[0])
- cursor.execute("SELECT item_id FROM items WHERE owner_id=%s AND loc=%s", (owner, 'INVENTORY'))
- items = cursor.fetchall()
- user_items = set()
- for item in items:
- user_items.add(item[0])
- user_access_items = (all_good_items & user_items)
- print "<center><h3>Шаг 2-й:</h3>"
- print "Выберите итем для продажи"
- print "<form action=\"step2.cgi\" method=\"post\">"
- print "<select name=\"item_select\">"
- for i in user_access_items:
- u = dict_with_all_good_items[i]
- print """
- <option value="%s">%s</option>
- """ % (i, u)
- print """</select><br><br>
- <input type="submit" value="Дальше"> """
- db.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement