Skip to content
Permalink
Browse files

Significantly changed the layout of the server.

All parts of the server can now be run on their own or used as a class.
master_server.py will start running all of the servers at once.
  • Loading branch information...
polaris- committed Apr 10, 2014
1 parent b334433 commit 986627e6451d9af2eb572f85e22664fa4c3c74ef
@@ -142,7 +142,7 @@ def get_user_list(self):

return users

def update_profile(self, session_key, fields):
def update_profile(self, session_key, field):
profileid = self.get_profileid_from_session_key(session_key)

if profileid != -1:
@@ -151,10 +151,9 @@ def update_profile(self, session_key, fields):
# TODO: Optimize this so it's done all in one update.
# FIXME: Possible security issue due to embedding an unsanitized string directly into the statement.
c = self.conn.cursor()
for field in fields:
print "UPDATE users SET %s = %s WHERE profileid = %s" % (field[0], field[1], profileid)
c.execute("UPDATE users SET %s = ? WHERE profileid = ?" % (field[0]), [field[1], profileid])
self.conn.commit()
print "UPDATE users SET %s = %s WHERE profileid = %s" % (field[0], field[1], profileid)
c.execute("UPDATE users SET %s = ? WHERE profileid = ?" % (field[0]), [field[1], profileid])
self.conn.commit()

# Session functions
# TODO: Cache session keys so we don't have to query the database every time we get a profile id.

0 comments on commit 986627e

Please sign in to comment.
You can’t perform that action at this time.