Index: server/DataAccess.cpp
===================================================================
--- server/DataAccess.cpp	(revision 66c4ec42dbedcfd532692a88c21a6ef3d1a07cba)
+++ server/DataAccess.cpp	(revision 521c88b9fbbaf5e789f2d4f2cedd46d4d6b31752)
@@ -24,5 +24,5 @@
 }
 
-int DataAccess::insertPlayer(string username, string password)
+int DataAccess::insertPlayer(string username, string password, Player::PlayerClass playerClass)
 {
    ostringstream oss;
@@ -46,7 +46,7 @@
    string encrypted(crypt(password.c_str(), salt.c_str()));
 
-   oss << "'" << username << "', '" << encrypted << "'";
+   oss << "'" << username << "', '" << encrypted << "', " << playerClass;
 
-   return insert("users", "name, password", oss.str());
+   return insert("users", "name, password, class", oss.str());
 }
 
@@ -84,4 +84,7 @@
       cout << "Creating a new player" << endl;
       p = new Player(string(row[1]), string(row[2]));
+      p->setClass((Player::PlayerClass)atoi(row[3]));
+      cout << "Class from db: " << atoi(row[3]) << endl;
+      cout << "Player class: " << p->playerClass << endl;
       cout << "Created new player" << endl;
    }else {
Index: server/DataAccess.h
===================================================================
--- server/DataAccess.h	(revision 66c4ec42dbedcfd532692a88c21a6ef3d1a07cba)
+++ server/DataAccess.h	(revision 521c88b9fbbaf5e789f2d4f2cedd46d4d6b31752)
@@ -16,5 +16,5 @@
    ~DataAccess();
 
-   int insertPlayer(string username, string password);
+   int insertPlayer(string username, string password, Player::PlayerClass playerClass);
    int updatePlayer(string username, string password);
 
Index: server/server.cpp
===================================================================
--- server/server.cpp	(revision 66c4ec42dbedcfd532692a88c21a6ef3d1a07cba)
+++ server/server.cpp	(revision 521c88b9fbbaf5e789f2d4f2cedd46d4d6b31752)
@@ -529,9 +529,19 @@
          string username(clientMsg.buffer);
          string password(strchr(clientMsg.buffer, '\0')+1);
+         Player::PlayerClass playerClass;
+
+         memcpy(&playerClass, clientMsg.buffer+username.length()+password.length()+2, 4);
 
          cout << "username: " << username << endl;
          cout << "password: " << password << endl;
 
-         int error = da.insertPlayer(username, password);
+         if (playerClass == Player::CLASS_WARRIOR)
+            cout << "class: WARRIOR" << endl;
+         else if (playerClass == Player::CLASS_RANGER)
+            cout << "class: RANGER" << endl;
+         else
+            cout << "Unknown player class detected" << endl;
+
+         int error = da.insertPlayer(username, password, playerClass);
 
          if (!error)
@@ -574,15 +584,4 @@
             // choose a random team (either 0 or 1)
             p->team = rand() % 2;
-
-            // choose a random class
-            int intClass = rand() % 2;
-            switch (intClass) {
-               case 0:
-                  p->setClass(Player::CLASS_WARRIOR);
-                  break;
-               case 1:
-                  p->setClass(Player::CLASS_RANGER);
-                  break;
-            }
 
             // tell the new player about all the existing players
