Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 22:55

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help]Problem with AuthServer

Discussion on [Help]Problem with AuthServer within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2007
Posts: 87
Received Thanks: 0
[Help]Problem with AuthServer

Hello there, I'm using the hasan source for patch 5375. I have been messing around with the database, I wanted to change where the Username, Password, IP, Email and LastCheck to a different Database_table. The old table was called "accounts" the new is, "user".

I have edited the AuthServer and GameServer projects (AccountTable.cs). I'm sure I've done this correct, but I am receiving an error trying to login to the server on my AuthServer Command window. This is the error;

Code:
MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time val
ue to System.DateTime
   at MySql.Data.Types.MySqlDateTime.GetDateTime()
   at MySql.Data.MySqlClient.MySqlDataReader.GetValue(Int32 i)
   at MySql.Data.MySqlClient.MySqlDataReader.GetValues(Object[] values)
   at System.Data.ProviderBase.DataReaderContainer.CommonLanguageSubsetDataReade
r.GetValues(Object[] values)
   at System.Data.ProviderBase.SchemaMapping.LoadDataRow()
   at System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping)
   at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable d
atatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, In
t32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
   at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDat
aReader dataReader, Int32 startRecord, Int32 maxRecords)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[]
 datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand co
mmand, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
   at AuthServer.Database.MySqlReader.TryFill(MySqlCommand command) in C:\Docume
nts and Settings\Kyle Lewis\Desktop\Conquer Online P-Server\Sources\hasan\AuthSe
rver\Database\MYSQL\MySqlReader.cs:line 42
[Auth-Socket] Incomming connection to Test and password

Please could someone tell me why the database was unable to convert date and time(LastCheck), I've never came across an error like this before, So I would like to know how to fix it.

Thanks.

Edit: I've also changed, the name of the old fields, Username is now username(lowercaps), this is the same with most apart from LastActivity. I've also edited this on my project.
kyle191 is offline  
Old 01/03/2012, 06:13   #2
 
Arco.'s Avatar
 
elite*gold: 0
Join Date: Feb 2011
Posts: 335
Received Thanks: 170
My solution to that was to save it as a string, and read it off as a string and convert it to datetime.
Arco. is offline  
Old 01/03/2012, 06:21   #3
 
12k's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
Quote:
Originally Posted by Arco. View Post
My solution to that was to save it as a string, and read it off as a string and convert it to datetime.
yupp, thats about the only way to do that. Unless you wanted to use a time in the database instead of a datetime.
12k is offline  
Old 01/03/2012, 07:22   #4
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Or binary.
Code:
long bintime = DateTime.Now.ToBinary();
DateTime time = DateTime.FromBinary(bintime);
I don't have a username is offline  
Old 01/03/2012, 16:33   #5
 
elite*gold: 0
Join Date: Nov 2007
Posts: 87
Received Thanks: 0
Thanks for the replies people, I just really don't understand why it's got to have a fit when I just change the path and a few names of the accounts table. Isn't there a much simpler solution. Maybe I set the LastCheck database field wrong, even though I did highlight the field and copy, then pasted into my new table(using Navicat).


PS: to make it more understandable for you guys, I'm trying to combine the conquer accounts table with a forums user table, therefore when they signup to my forum, this would also sign them up to the game.

This is my AccountTable.cs.

Code:
using System;
using System.IO;
using System.Text;

namespace AuthServer.Database
{
    public class AccountTable
    {
        public enum AccountState : byte
        { ProjectManager = 4, GameMaster = 3, Player = 2, Banned = 1, DoesntExist = 0 }
        public string Username;
        public string Password;
        public string Email;
        public string IP;
        public DateTime LastCheck;
        public AccountState State;
        public uint EntityID;
        public uint AccountID;
        private bool exists = false;
        public AccountTable(string username)
        {
            this.AccountID = 0;
            this.Username = username;
            this.Password = "";
            this.IP = "";
            this.LastCheck = DateTime.Now;
            this.State = AccountState.DoesntExist;
            this.EntityID = 0;
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("user").Where("username", username);
            MySqlReader r = new MySqlReader(cmd );
            if (r.Read())
            {
                exists = true;
                this.AccountID = r.ReadUInt32("userid");
                this.Password = r.ReadString("password");
                this.IP = r.ReadString("ipaddress");
                this.EntityID = r.ReadUInt32("EntityID");
                this.LastCheck = DateTime.FromBinary(r.ReadInt64("LastCheck"));
                this.State = (AccountState)r.ReadByte("State");
                this.Email = r.ReadString("email");
            }
        }

        public void Save()
        {
            if (exists)
            {
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
                cmd.Update("user").Set("password", Password).Set("ipaddress", IP).Set("EntityID", EntityID).Set("LastCheck", (ulong)DateTime.Now.ToBinary()).Set("State", (byte)State).Where("username", Username).Execute();
            }
            else
            {
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
                cmd.Insert("user").Insert("username", Username).Insert("password", Password).Insert("State", (byte)State).Execute();
            }
        }
    }
}
kyle191 is offline  
Old 01/03/2012, 20:24   #6
 
12k's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
Its just the way that your mysql reader works. Its trying to read it as a datetime before you even use the r.readint64, and is causing the error. If your using the typical mysqlreader most servers use, its most likely in the TryFill method. (From what I can see)
12k is offline  
Old 01/04/2012, 01:17   #7
 
elite*gold: 0
Join Date: Nov 2007
Posts: 87
Received Thanks: 0
I've figured out what's making me have this error. In the same Table as my conquer user, LastCheck etc I have vBulletin user tables. I have connected the users and tested them but there are two fields that are giving me this error, they are;
birthday_search Type=date Default=0000-00-00
passworddate Type=date Default=0000-00-00

I have tested if I remove those fields, conquer works but the forum obviously doesn't. How can I change this?

LastCheck Type=bigint Default=NULL Unsigned.

So basically, it's these 2 type"date" that are causing the error "Unable to convert MYSQL date/time"
kyle191 is offline  
Old 01/04/2012, 02:16   #8
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Why do you even have your forum and your conquerserver in the same db?
I don't have a username is offline  
Old 01/04/2012, 02:42   #9
 
elite*gold: 0
Join Date: Nov 2007
Posts: 87
Received Thanks: 0
So when people create a user on the forum it will create their game login.


Basically all I needed to do is change a few fields where conquer pulls data out of the db. That has no problem, but as I said above, with 2 db fields which are type data, seems to mess stop me from logging into the gameserver giving me an error on my AuthServer command window, Stating "Unable to convert MYSQL date/time".


Please help me lol, it's a weird problem.
kyle191 is offline  
Old 01/04/2012, 08:57   #10
 
12k's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
The main reason this happens, is because it cant convert a empty datetime (00:00:00) etc, to a datetime. So if you simply want to ignore those empty datetimes, add this to the end of your mysql connection string:

Quote:
Allow Zero Datetime=true;
12k is offline  
Thanks
1 User
Old 01/04/2012, 12:28   #11
 
elite*gold: 0
Join Date: Nov 2007
Posts: 87
Received Thanks: 0
Quote:
Originally Posted by 12k View Post
The main reason this happens, is because it cant convert a empty datetime (00:00:00) etc, to a datetime. So if you simply want to ignore those empty datetimes, add this to the end of your mysql connection string:
Thanks, that makes more sense now, only thing that doesn't is I'm not sure where to add it, this is my AuthServer Code;

Code:
using System;
using System.IO;
using System.Text;

namespace AuthServer.Database
{
    public class AccountTable
    {
        public enum AccountState : byte
        { ProjectManager = 4, GameMaster = 3, Player = 2, Banned = 1, DoesntExist = 0 }
        public string Username;
        public string Password;
        public string Email;
        public string IP;
        public DateTime LastCheck;
        public AccountState State;
        public uint EntityID;
        public uint AccountID;
        private bool exists = false;
        public AccountTable(string username)
        {
            this.AccountID = 0;
            this.Username = username;
            this.Password = "";
            this.IP = "";
            this.LastCheck = DateTime.Now;
            this.State = AccountState.DoesntExist;
            this.EntityID = 0;
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("user").Where("username", username);
            MySqlReader r = new MySqlReader(cmd );
            if (r.Read())
            {
                exists = true;
                this.AccountID = r.ReadUInt32("userid");
                this.Password = r.ReadString("password");
                this.IP = r.ReadString("ipaddress");
                this.EntityID = r.ReadUInt32("EntityID");
                this.LastCheck = DateTime.FromBinary(r.ReadInt64("LastCheck"));
                this.State = (AccountState)r.ReadByte("State");
                this.Email = r.ReadString("email");
                
            }
        }

        public void Save()
        {
            if (exists)
            {
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
                cmd.Update("user").Set("password", Password).Set("ipaddress", IP).Set("EntityID", EntityID).Set("LastCheck", (ulong)DateTime.Now.ToBinary()).Set("State", (byte)State).Where("username", Username).Execute();
            }
            else
            {
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
                cmd.Insert("user").Insert("username", Username).Insert("password", Password).Insert("State", (byte)State).Execute();
            }
        }
    }
}
PS: the way my LastCheck field is set up, has like 19 different numbers if you have a successful login.
kyle191 is offline  
Old 01/04/2012, 15:32   #12
 
12k's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
You need to add it to your connection string... So use control + F, make sure the bottom box is set to Entire Solution. Then search for Server=127.0.0.1, or Server=localhost. Put it at the end of that string.
12k is offline  
Thanks
1 User
Old 01/04/2012, 15:53   #13


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Provided that your database is hosted on the same machine as your server of course, if not then search for "= new MySqlConnection(" and then it'll either be there or the string will be referenced there.
Korvacs is offline  
Old 01/04/2012, 16:44   #14
 
12k's Avatar
 
elite*gold: 0
Join Date: Jul 2011
Posts: 218
Received Thanks: 33
Quote:
Originally Posted by Korvacs View Post
Provided that your database is hosted on the same machine as your server of course, if not then search for "= new MySqlConnection(" and then it'll either be there or the string will be referenced there.
That may or may not work. Because some servers use it as the following to prevent it from conflicting with the name of the variable inside the database class.

Quote:
return new MySql.Data.MySqlClient.MySqlConnection("Server=bla h blah");
So you could just search for:

Quote:
MySqlConnection("Server=
12k is offline  
Old 01/04/2012, 16:53   #15


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Cant believe you felt the need to comment on that, well considering the fact that people may also not just have the string, you should probably just search for this:

Code:
MySqlConnection(
Korvacs is offline  
Reply


Similar Threads Similar Threads
Authserver problem
08/29/2011 - CO2 Private Server - 5 Replies
I can't seems to find the problem with my authserver, but it's stucked at "Logging into Account server". It connects fine to the server, but it seems like I might structured something wrong in the packets? Or I forgot to make something? Screenshot of my codes: http://i.min.us/iElqeNCQxq15A.png http://i.min.us/ioG5G9hUq9J63.png
AuthServer problem.
03/06/2011 - CO2 Private Server - 4 Replies
#Problem solved. This can be closed.
AuthServer De/En ?
11/20/2010 - CO2 Programming - 4 Replies
First of all i wanna say hello to every1. And after reading lots of information about conquer cryptograpgy cant figure out what exactly encryption/decryption loginserver use? Somethig similar to XOR encryption ? what exactly? If i dont know that exactly it is then i cant write my proxy. I`ve read pro4ever thread but there is only explanation how proxys works and almost zero about how to create it (i dont need that some1 give me full code of proxy).
[HELP] Error when in AuthServer.cs
06/08/2009 - CO2 Private Server - 3 Replies
IM gettin this an error on line 31 of Auth Server http://img41.imageshack.us/img41/7368/erroreuj.pn g This is my AuthServer.cs /* * Created by SharpDevelop. * User: sams * Date: 3/8/2009 * Time: 2:19 PM *
AuthServer password encryption
04/26/2009 - CO2 Private Server - 1 Replies
Well thought it would fit in this section. Most of the sources I seen works this way: the first time an account login, it takes the "encrypted" password received and set it in the database. I've been trying to figure the encryption used, but with no success, my ASM skills just sucks. So, could anyone decent with assembler/debugging help me with this?



All times are GMT +2. The time now is 22:55.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.