Register for your free account! | Forgot your password?

You last visited: Today at 01:07

  • 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 07/24/2009, 08:28   #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 07/24/2009, 09:00   #3
 
elite*gold: 0
Join Date: May 2009
Posts: 874
Received Thanks: 174
lol smarta*s
Arcotemple:) is offline  
Old 07/24/2009, 09:14   #4
 
elite*gold: 20
Join Date: Aug 2005
Posts: 1,734
Received Thanks: 1,000
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.AnsiSetLastError trueExactSpelling true)]
        private static 
extern int GetPrivateProfileStringA(string Sectionstring Keystring Default, StringBuilder Bufferint BufferSizestring FileName);
        [
DllImport("kernel32.dll"CharSet CharSet.AnsiSetLastError trueExactSpelling true)]
        private static 
extern int WritePrivateProfileStringA(string Sectionstring Keystring Valuestring 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 Sectionstring Keystring Value)
        {
           
                
WritePrivateProfileStringA(SectionKeyValueLocation);
        }
    } 
tanelipe is offline  
Thanks
1 User
Old 07/24/2009, 16:34   #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 07/24/2009, 16:38   #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 +2. The time now is 01:07.


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.