فهرست منبع

Auf neue Datenbank ausgerichtet

Kolja Strohm 7 سال پیش
والد
کامیت
37869839b0
4فایلهای تغییر یافته به همراه24 افزوده شده و 166 حذف شده
  1. 10 6
      AppServer Linux/AppServer Linux.vcxproj
  2. 0 59
      AppServer/AppServer.cpp
  3. 12 96
      AppServer/Datenbank.cpp
  4. 2 5
      AppServer/Datenbank.h

+ 10 - 6
AppServer Linux/AppServer Linux.vcxproj

@@ -39,18 +39,22 @@
     <TargetName>AppServer</TargetName>
     <TargetExt>
     </TargetExt>
-    <RemoteProjectDir>$(RemoteRootDir)/Server/AppServer/Release</RemoteProjectDir>
-    <IncludePath>..\..\..\Allgemein\Framework;../../../Framework/Release;..\..\..\Allgemein\Network\Network;../../../Network/Release;..\..\..\Allgemein\sql\sql;../../../sql/Release;..\AppServer;$(IncludePath)</IncludePath>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/AppServer/release</RemoteProjectDir>
+    <IncludePath>..\..\..\Allgemein\Framework;../../../Framework/release;..\..\..\Allgemein\Network\Network;../../../Network/release;..\..\..\Allgemein\sql\sql;../../../sql/release;..\AppServer;$(IncludePath)</IncludePath>
     <LibraryPath>
     </LibraryPath>
+    <OutDir>$(ProjectDir)bin\$(Platform)\release\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\release\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <TargetName>AppServer</TargetName>
     <TargetExt />
-    <RemoteProjectDir>$(RemoteRootDir)/Server/AppServer/Debug</RemoteProjectDir>
-    <IncludePath>..\..\..\Allgemein\Framework;../../../Framework/Debug;..\..\..\Allgemein\Network\Network;../../../Network/Debug;..\..\..\Allgemein\sql\sql;../../../sql/Debug;..\AppServer;$(IncludePath)</IncludePath>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/AppServer/debug</RemoteProjectDir>
+    <IncludePath>..\..\..\Allgemein\Framework;../../../Framework/debug;..\..\..\Allgemein\Network\Network;../../../Network/debug;..\..\..\Allgemein\sql\sql;../../../sql/debug;..\AppServer;$(IncludePath)</IncludePath>
     <LibraryPath>
     </LibraryPath>
+    <OutDir>$(ProjectDir)bin\$(Platform)\debug\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\debug\</IntDir>
   </PropertyGroup>
   <ItemGroup>
     <ClInclude Include="..\AppServer\AppServer.h" />
@@ -65,7 +69,7 @@
     <Link>
       <LibraryDependencies>dbgFramework;dbgNetwork;dbgSQL;pq;pthread</LibraryDependencies>
       <SharedLibrarySearchPath>%(SharedLibrarySearchPath)</SharedLibrarySearchPath>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/Framework/Debug/bin/x64/debug;$(RemoteRootDir)/Network/Debug/bin/x64/debug;$(RemoteRootDir)/sql/Debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/Framework/debug/bin/x64/debug;$(RemoteRootDir)/Network/debug/bin/x64/debug;$(RemoteRootDir)/sql/debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <AdditionalOptions>-Wl,-rpath,/test/lib %(AdditionalOptions)</AdditionalOptions>
     </Link>
     <ClCompile />
@@ -73,7 +77,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <Link>
       <LibraryDependencies>Framework;Network;SQL;pq;pthread</LibraryDependencies>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/Framework/Release/bin/x64/release;$(RemoteRootDir)/Network/Release/bin/x64/release;$(RemoteRootDir)/sql/Release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/Framework/release/bin/x64/release;$(RemoteRootDir)/Network/release/bin/x64/release;$(RemoteRootDir)/sql/release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
     </Link>
     <ClCompile>
       <AdditionalOptions>-Wl,-rpath,../lib %(AdditionalOptions)</AdditionalOptions>

+ 0 - 59
AppServer/AppServer.cpp

@@ -1124,65 +1124,6 @@ void AppSKlient::thread()
                 delete[] device;
                 break;
             }
-            case 32: // Curvesnake finish Game
-            {
-                klient->sendeEncrypted( "\1", 1 );
-                int score = 0;
-                klient->getNachrichtEncrypted( (char*)&score, 4 );
-                int map = 0;
-                klient->getNachrichtEncrypted( (char*)&map, 4 );
-                if( accountId )
-                {
-                    int kupfer = 0;
-                    klient->getNachrichtEncrypted( (char*)&kupfer, 4 );
-                    klient->getNachrichtEncrypted( (char*)&kupfer, 4 );
-                    appS->zDB()->curvesnakeFinish( score, accountId, 0, map, kupfer );
-                }
-                else
-                {
-                    char l = 0;
-                    klient->getNachrichtEncrypted( &l, 1 );
-                    char *device = new char[ l + 1 ];
-                    device[ (int)l ] = 0;
-                    klient->getNachrichtEncrypted( device, l );
-                    appS->zDB()->curvesnakeFinish( score, accountId, device, map, 0 );
-                    delete[] device;
-                }
-                klient->sendeEncrypted( "\1", 1 );
-                break;
-            }
-            case 33: // Curvesnake best score
-            {
-                klient->sendeEncrypted( "\1", 1 );
-                Array< int > *map = new Array< int >();
-                Array< int > *score = new Array< int >();
-                int anz = appS->zDB()->getCurvesnakeScore( map, score );
-                klient->sendeEncrypted( (char*)&anz, 4 );
-                for( int i = 0; i < anz; i++ )
-                {
-                    int l = map->get( i );
-                    klient->sendeEncrypted( (char*)&l, 4 );
-                    int s = score->get( i );
-                    klient->sendeEncrypted( (char*)&s, 4 );
-                }
-                map->release();
-                score->release();
-                break;
-            }
-            case 34: // Curvesnake get Map List
-            {
-                klient->sendeEncrypted( "\1", 1 );
-                Array< int > *map = new Array< int >();
-                int anz = appS->zDB()->getCurvesnakeMapList( map, accountId );
-                klient->sendeEncrypted( (char*)&anz, 4 );
-                for( int i = 0; i < anz; i++ )
-                {
-                    int l = map->get( i );
-                    klient->sendeEncrypted( (char*)&l, 4 );
-                }
-                map->release();
-                break;
-            }
             case 35: // Add Kupfer
             {
                 if( accountId )

+ 12 - 96
AppServer/Datenbank.cpp

@@ -109,9 +109,9 @@ int AppSDatenbank::login( char *name, char *passwort )
 {
     Text befehl = "SELECT id FROM account WHERE name = '";
     befehl += name;
-    befehl += "' AND passwort = '";
+    befehl += "' AND passwort = md5('";
     befehl += passwort;
-    befehl += "'";
+    befehl += "')";
     lock();
     datenbank->befehl( befehl );
     Result res = datenbank->getResult();
@@ -594,11 +594,11 @@ bool AppSDatenbank::neuAccount( const char *name, const char *pass, const char *
     Text n( name );
     n.ersetzen( "'", "''" );
     befehl->append( (char*)n );
-    befehl->append( "', '" );
+    befehl->append( "', md5('" );
     Text p( pass );
     p.ersetzen( "'", "''" );
     befehl->append( (char*)p );
-    befehl->append( "', '" );
+    befehl->append( "'), '" );
     Text g( geheim );
     g.ersetzen( "'", "''" );
     befehl->append( (char*)g );
@@ -717,11 +717,11 @@ char AppSDatenbank::suchBestaetigung( const char *name, const char *pass )
     Text n( name );
     n.ersetzen( "'", "''" );
     befehl->append( (char*)n );
-    befehl->append( "', '" );
+    befehl->append( "', md5('" );
     Text p( pass );
     p.ersetzen( "'", "''" );
     befehl->append( (char*)p );
-    befehl->append( "' )" );
+    befehl->append( "') )" );
     lock();
     datenbank->befehl( befehl->getText() );
     Result res = datenbank->getResult();
@@ -734,7 +734,7 @@ char AppSDatenbank::suchBestaetigung( const char *name, const char *pass )
 
 void AppSDatenbank::sendeErstellEMail( const char *name, InitDatei *zIni )
 {
-    Text *befehl = new Text( "SELECT passwort, geheimnis, e_mail, geb_datum, schluessel FROM account_neu WHERE name = '" );
+    Text *befehl = new Text( "SELECT geheimnis, e_mail, geb_datum, schluessel FROM account_neu WHERE name = '" );
     Text n( name );
     n.ersetzen( "'", "''" );
     befehl->append( (char*)n );
@@ -747,21 +747,19 @@ void AppSDatenbank::sendeErstellEMail( const char *name, InitDatei *zIni )
     Datei md;
     if( res.zeilenAnzahl )
     {
-        md.setDatei( res.values[ 4 ].getText() );
+        md.setDatei( res.values[ 3 ].getText() );
         if( md.open( Datei::Style::schreiben ) )
         {
-            Text txt = res.values[ 2 ].getText();
+            Text txt = res.values[ 1 ].getText();
             txt += "\naccount activation\n Account Details:\n";
             txt += "\r\nname: ";
             txt += name;
-            txt += "\r\npassword: ";
-            txt += res.values[ 0 ].getText();
             txt += "\r\nsecret: ";
-            txt += res.values[ 1 ].getText();
+            txt += res.values[ 0 ].getText();
             txt += "\r\ndate of birth: ";
-            txt += res.values[ 3 ].getText();
+            txt += res.values[ 2 ].getText();
             txt += "\r\nactivation key: ";
-            txt += res.values[ 4 ].getText();
+            txt += res.values[ 3 ].getText();
             md.schreibe( txt, txt.getLength() );
             md.close();
             // e_mail senden
@@ -1057,88 +1055,6 @@ int AppSDatenbank::getMarkballsFortschritt( int accountId, char *device, Array<
     return anz;
 }
 
-void AppSDatenbank::curvesnakeFinish( int score, int accId, char *device, int map, int kupfer )
-{
-    Text befehl = "SELECT id FROM curvesnake WHERE map = ";
-    befehl += map;
-    lock();
-    datenbank->befehl( befehl );
-    int anz = datenbank->getZeilenAnzahl();
-    unlock();
-    if( !anz )
-    {
-        befehl = "INSERT INTO curvesnake( map, score ) VALUES( ";
-        befehl += map;
-        befehl += ", 0 )";
-        lock();
-        datenbank->befehl( befehl );
-        unlock();
-    }
-    befehl = "UPDATE curvesnake SET score = ";
-    befehl += score;
-    if( device )
-    {
-        befehl += ", device = '";
-        befehl += device;
-        befehl += "'";
-    }
-    else
-    {
-        befehl += ", account_id = ";
-        befehl += accId;
-    }
-    befehl += " WHERE map = ";
-    befehl += map;
-    lock();
-    datenbank->befehl( befehl );
-    unlock();
-    if( !device && kupfer )
-    {
-        befehl = "UPDATE account SET kupfer = kupfer + ";
-        befehl += kupfer;
-        befehl += " WHERE id = ";
-        befehl += accId;
-        lock();
-        datenbank->befehl( befehl );
-        unlock();
-    }
-}
-
-int AppSDatenbank::getCurvesnakeScore( Array< int > *map, Array< int > *score )
-{
-    lock();
-    datenbank->befehl( "SELECT map, score from curvesnake ORDER BY map" );
-    Result r = datenbank->getResult();
-    unlock();
-    for( int i = 0; i < r.zeilenAnzahl; i++ )
-    {
-        map->add( r.values[ i * 2 ] );
-        score->add( r.values[ i * 2 + 1 ] );
-    }
-    int ret = r.zeilenAnzahl;
-    r.destroy();
-    return ret;
-}
-
-int AppSDatenbank::getCurvesnakeMapList( Array< int > *map, int account )
-{
-    Text befehl = "SELECT id from curvesnake_map WHERE preis = 0 ";
-    if( account )
-    {
-        befehl += "UNION SELECT map_id FROM curvesnake_map_account WHERE account_id = ";
-        befehl += account;
-    }
-    lock();
-    datenbank->befehl( befehl );
-    Result r = datenbank->getResult();
-    unlock();
-    for( int i = 0; i < r.zeilenAnzahl; i++ )
-        map->add( r.values[ i ] );
-    int ret = r.zeilenAnzahl;
-    r.destroy();
-    return ret;
-}
-
 void AppSDatenbank::addKupfer( int account, int kupfer )
 {
     Text befehl = "UPDATE account SET kupfer = kupfer + ";

+ 2 - 5
AppServer/Datenbank.h

@@ -10,8 +10,8 @@ using namespace sql;
 
 namespace Admin_Recht
 {
-    const int AppSStarten = 62;
-    const int AppSBeenden = 63;
+    const int AppSStarten = 57;
+    const int AppSBeenden = 58;
 }
 
 class AppSDatenbank
@@ -67,9 +67,6 @@ public:
     int getGegenstaende( int accountId, char *device, Array< int > *gId, Array< int > *diff );
     int getKupfer( int accountId );
     int getMarkballsFortschritt( int accountId, char *device, Array< int > *f );
-    void curvesnakeFinish( int score, int accId, char *device, int map, int kupfer );
-    int getCurvesnakeScore( Array< int > *map, Array< int > *score );
-    int getCurvesnakeMapList( Array< int > *map, int account );
     void addKupfer( int account, int kupfer );
     bool getFreeAds( int account );
     // Reference Counting