Register for your free account! | Forgot your password?

Go Back   elitepvpers › MMORPGs › Conquer Online 2 › CO2 Private Server
You last visited: Today at 20:11

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

Advertisement



[Help] SQL to INI

Discussion on [Help] SQL to INI within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2007
Posts: 128
Received Thanks: 80
[Help] SQL to INI

how can i convert mysql to ini? can someone help me. Thanks.
nestreys is offline  
Old   #2
 
elite*gold: 0
Join Date: Jul 2009
Posts: 548
Received Thanks: 52
Well INSERT is like Write i think
f0am is offline  
Thanks
1 User
Old   #3
 
elite*gold: 0
Join Date: May 2009
Posts: 874
Received Thanks: 174
lol smarta*s
Arcotemple:) is offline  
Old   #4
 
elite*gold: 20
Join Date: Aug 2005
Posts: 1,734
Received Thanks: 1,001
Alright this should do it. I'm not familiar with MySQL so do the corrections on classes/mysql syntax. I've provided you with a simple account transfer, there is also a really really simple ini class.

PHP Code:
public static void TransferAccounts(string Table) {

    
MySqlCommand Command = MySqlCommand("SELECT * FROM `Table`");
    
MySqlDataReader DR = Command.ExecuteReader(); // Or something similar.
    
while(DR.Read()) {
        
// These are just examples. We're 'trimming' them incase there is white spaces.
        
string Username = (DR["Username"] as string).Trim();
        
string Password = (DR["Password"] as string).Trim();

        
IniFile iFile = new IniFile("D:\\ConquerServer\\Database\\Accounts\\" + Username + ".ini");
        if(!
iFile.Exists) {
            
// Assuming that we don't want to override any existing accounts.
            
iFile.WriteString("Accounts", "Username", Username);
            
iFile.WriteString("Accounts", "Password", Password);
        }
    }
    
DR.Close();
} 
PHP Code:
class IniFile
    
{
        [
DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        private static 
extern int GetPrivateProfileStringA(string Section, string Key, string Default, StringBuilder Buffer, int BufferSize, string FileName);
        [
DllImport("kernel32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
        private static 
extern int WritePrivateProfileStringA(string Section, string Key, string Value, string FileName);
        private 
string Location;
        private 
bool Found;

        public 
IniFile(string Location)
        {
            
this.Location = Location;
            
this.Found = File.Exists(Location);
        }
        public 
bool Exists { get { return Found; } }
        public 
void WriteString(string Section, string Key, string Value)
        {
           
                
WritePrivateProfileStringA(Section, Key, Value, Location);
        }
    } 
tanelipe is offline  
Thanks
1 User
Old   #5
 
elite*gold: 20
Join Date: May 2008
Posts: 1,103
Received Thanks: 254
Dont go to ini its not gonna help with accounts freezing
Pete1990 is offline  
Thanks
1 User
Old   #6
 
elite*gold: 0
Join Date: Nov 2007
Posts: 128
Received Thanks: 80
Oh okay Pete. Thanks.
nestreys is offline  
Reply




All times are GMT +1. The time now is 20:11.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

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