00001 #ifndef _SIMPLEWEB_H 00002 #define _SIMPLEWEB_H 00003 00004 #include <libcgi++.h> 00005 #include <mysql/mysql.h> 00006 #include <libmysqlwrapped.h> 00007 #include "LobbyForm.h" 00008 #include "MainForm.h" 00009 #include "BuildForm.h" 00010 00011 #define COOKIE_DOMAIN ".alhem.net" 00012 #define COOKIE_PATH "/cgi-bin/simple/" 00013 00014 00015 class SimpleWeb : public Web 00016 { 00017 public: 00018 SimpleWeb(); 00019 ~SimpleWeb(); 00020 00021 void ReadCookies(); 00022 void FormInput(); 00023 void CreateHeader(); 00024 void GenerateDocument(); 00025 00026 void SetTheCookie(); 00027 00028 void SetAccount(long x) { if (x != m_account) m_b_set_cookie = true; m_account = x; } 00029 long GetAccount() { return m_account; } 00030 void SetPlayer(long x) { if (x != m_player) m_b_set_cookie = true; m_player = x; } 00031 long GetPlayer() { return m_player; } 00032 void SetValid(long x) { if (x != m_valid) m_b_set_cookie = true; m_valid = x; } 00033 long GetValid() { return m_valid; } 00034 void SetSkill(long x) { if (x != m_skill) m_b_set_cookie = true; m_skill = x; } 00035 long GetSkill() { return m_skill; } 00036 void SetBuilding(long x) { if (x != m_building) m_b_set_cookie = true; m_building = x; } 00037 long GetBuilding() { return m_building; } 00038 void SetSuperuservy(short x) { if (x != m_superuservy) m_b_set_cookie = true; m_superuservy = x; } 00039 short GetSuperuservy() { return m_superuservy; } 00040 void SetLocation(long x) { if (x != m_location) m_b_set_cookie = true; m_location = x; } 00041 long GetLocation() { return m_location; } 00042 void SetBuild(short x) { if (x != m_build) m_b_set_cookie = true; m_build = x; } 00043 short GetBuild() { return m_build; } 00044 00045 Database& GetDatabase() { return m_db; } 00046 std::string GetRandomName(); 00047 long CreateNPC(); 00048 00049 void Run(); 00050 00051 private: 00052 Database m_db; 00053 bool m_b_set_cookie; 00054 long m_account; 00055 long m_player; 00056 long m_valid; 00057 long m_skill; 00058 long m_building; 00059 short m_superuservy; 00060 long m_location; 00061 short m_build; 00062 // 00063 LobbyForm m_form_lobby; 00064 MainForm m_form_main; 00065 BuildForm m_form_build; 00066 }; 00067 00068 00069 #endif // _SIMPLEWEB_H