Пример #1
0
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            // Login with specified account data
            sqlFunctions sql = new sqlFunctions();

            if (sql.login(textBox1.Text, textBox2.Text) == true)
            {
                // This will trigger a successfull login
                string appPath = Path.GetDirectoryName(Application.ExecutablePath);

                System.IO.StreamWriter file = new System.IO.StreamWriter(appPath + "/lastuser.txt");
                file.WriteLine(textBox1.Text);
                file.Close();

                // Open the main GUI
                Main main = new Main();
                main.Show();
                this.Hide();
            }
            else
            {
                // The login failed, since the user doesn't match anything in the database.
                label3.Visible = true;
            }
        }
Пример #2
0
        private void button3_Click(object sender, EventArgs e)
        {
            sqlFunctions sql = new sqlFunctions();

            if (sql.setPassword(toolStripStatusLabel2.Text, textBox5.Text) == true)
            {
            }
            else
            {
            }
        }
Пример #3
0
        private void button10_Click_1(object sender, EventArgs e)
        {
            sqlFunctions sql = new sqlFunctions();

            WebClient       client   = new WebClient();
            string          ip       = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/1.txt");
            string          usr      = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/2.txt");
            string          pw       = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/3.txt");
            MySqlConnection conn3    = new MySqlConnection("server=" + ip + ";userid=" + usr + ";password="******";database=114794-donations");
            MySqlCommand    getauth2 = new MySqlCommand("SELECT * FROM users WHERE username = '******';");

            getauth2.Parameters.AddWithValue("username", textBox1.Text);
            getauth2.Connection = conn3;
            conn3.Open();
            MySqlDataReader Reader2 = getauth2.ExecuteReader();

            Reader2.Read();
            string canusercon = sql.GetDBString("canuseremote", Reader2);
            string isadmin    = sql.GetDBString("isadmin", Reader2);

            if (textBox10.Text.Contains("h"))
            {
                MessageBox.Show("Ban length needs to be set in numbers!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox10.Text.Contains("m"))
            {
                MessageBox.Show("Ban length needs to be set in numbers!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (textBox10.Text.Contains("s"))
            {
                MessageBox.Show("Ban length needs to be set in numbers!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            if (isadmin == "true")
            {
                remote.ServerCommand("ulx banid " + textBox7.Text + " " + textBox9.Text + " " + textBox8.Text);

                MessageBox.Show("Player with SteamID: " + textBox7.Text + " has his/her ban edited.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                // Hide Banlist, Show 'Add Ban' Panel
                listView1.Visible = true;
                panel17.Visible   = false;
                remote.ServerCommand("say [SmurfRP Server Tool] Ban with SteamID: " + textBox7.Text + " was edited by " + textBox1.Text);
            }
            else
            {
                MessageBox.Show("ERROR: Your user-group does not have sufficient rights to use the Remote Console.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                panel17.Visible   = false;
                listView1.Visible = true;
            }
        }
Пример #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            sqlFunctions sql = new sqlFunctions();

            if (sql.writeAvatar(textBox6.Text, textBox1.Text) == true)
            {
                pictureBox2.ImageLocation = textBox6.Text;
                MessageBox.Show("Avatar was successfully updated!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Failed to update avatar!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #5
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            // Register
            sqlFunctions sql = new sqlFunctions();

            if (sql.register(textBox1.Text, textBox2.Text) == true)
            {
                // Register Succeeded
            }
            else
            {
                // Register Failed
            }
        }
Пример #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            sqlFunctions sql = new sqlFunctions();

            WebClient       client   = new WebClient();
            string          ip       = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/1.txt");
            string          usr      = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/2.txt");
            string          pw       = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/3.txt");
            MySqlConnection conn3    = new MySqlConnection("server=" + ip + ";userid=" + usr + ";password="******";database=114794-donations");
            MySqlCommand    getauth2 = new MySqlCommand("SELECT * FROM users WHERE username = '******';");

            getauth2.Parameters.AddWithValue("username", textBox1.Text);
            getauth2.Connection = conn3;
            conn3.Open();
            MySqlDataReader Reader2 = getauth2.ExecuteReader();

            Reader2.Read();

            string canusercon = sql.GetDBString("canuseremote", Reader2);
            string isadmin    = sql.GetDBString("isadmin", Reader2);

            // Check user rights - If user is just a standard user, we'll deny his rights.
            if (this.Text.Contains("Not Logged In"))
            {
                MessageBox.Show("ERROR: You are not authenticated. Please login first.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            // Add the ability to clear the whole textbox
            else if (textBox4.Text == "/clear")
            {
                textBox3.Clear();
                textBox4.Text = "";
            }
            // Disallow usage of rcon if user has the "canuseremote" flag set to false.
            else if (canusercon == "false")
            {
                MessageBox.Show("ERROR: You do not have sufficient rights to use the Remote Console.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else if (isadmin == "false")
            {
                MessageBox.Show("ERROR: Your user-group does not have sufficient rights to use the Remote Console.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                // Send Command
                remote.ServerCommand(textBox4.Text);
            }
        }
Пример #7
0
        private void Main_Load(object sender, EventArgs e)
        {
            // Read userdata
            sqlFunctions sql     = new sqlFunctions();
            string       appPath = Path.GetDirectoryName(Application.ExecutablePath);

            System.IO.StreamReader file = new System.IO.StreamReader(appPath + "/lastuser.txt");
            string user;

            user = file.ReadLine();
            file.Close();
            MySqlConnection conn    = new MySqlConnection("server=mysql05.citynetwork.se;userid=114794-xs71327;password=valvehelpedme;database=114794-nettest");
            MySqlCommand    getauth = new MySqlCommand("SELECT * FROM users WHERE username = '******';");

            getauth.Parameters.AddWithValue("username", user);
            getauth.Connection = conn;
            conn.Open();
            MySqlDataReader Reader = getauth.ExecuteReader();

            this.Text = "Merriment CDS :: " + loc.EN_LOGGED_IN_AS + user;
            //label5.Text = "Merriment CDS :: " + loc.EN_LOGGED_IN_AS + user;

            while (Reader.Read())
            {
                label1.Text = (sql.GetDBString("username", Reader));
                label2.Text = (sql.GetDBString("usertitle", Reader));
                pictureBox1.ImageLocation = (sql.GetDBString("avatar", Reader));
                if (sql.GetDBString("isadmin", Reader) == "no")
                {
                    label3.Text = string.Empty;
                }
                else
                {
                    label3.Text = loc.EN_ADMIN;
                }
            }
            Reader.Close();
            conn.Close();

            // Fill listview with all applications which we will fetch from the database
            ListViewItem   listviewitem = new ListViewItem();
            AppDBFunctions appDB        = new AppDBFunctions();

            appDB.getApps(listView1, listviewitem, imageList1);
        }
Пример #8
0
        private void button2_Click(object sender, EventArgs e)
        {
            string appPath = Path.GetDirectoryName(Application.ExecutablePath);

            System.IO.StreamReader file = new System.IO.StreamReader(appPath + "/lastuser.txt");
            string user;

            user = file.ReadLine();
            file.Close();
            sqlFunctions sql = new sqlFunctions();

            if (sql.setPassword(user, textBox2.Text) == true)
            {
                this.Close();
            }
            else
            {
            }
        }
Пример #9
0
        private void button6_Click(object sender, EventArgs e)
        {
            sqlFunctions sql = new sqlFunctions();

            WebClient       client   = new WebClient();
            string          ip       = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/1.txt");
            string          usr      = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/2.txt");
            string          pw       = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/3.txt");
            MySqlConnection conn3    = new MySqlConnection("server=" + ip + ";userid=" + usr + ";password="******";database=114794-donations");
            MySqlCommand    getauth2 = new MySqlCommand("SELECT * FROM users WHERE username = '******';");

            getauth2.Parameters.AddWithValue("username", textBox1.Text);
            getauth2.Connection = conn3;
            conn3.Open();
            MySqlDataReader Reader2 = getauth2.ExecuteReader();

            Reader2.Read();
            string canusercon = sql.GetDBString("canuseremote", Reader2);
            string isadmin    = sql.GetDBString("isadmin", Reader2);


            if (isadmin == "true")
            {
                DialogResult dialogResult = MessageBox.Show("Do you really want to remove this ban with SteamID: " + listView1.FocusedItem.SubItems[0].Text + "?", "Some Title", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dialogResult == DialogResult.Yes)
                {
                    remote.ServerCommand("ulx unban " + listView1.FocusedItem.SubItems[0].Text);
                    MessageBox.Show("Player with SteamID: " + listView1.FocusedItem.SubItems[0].Text + " was successfully un-banned.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    remote.ServerCommand("say [SmurfRP Server Tool] " + listView1.FocusedItem.SubItems[0].Text + " was un-banned by " + textBox1.Text);
                }
                else if (dialogResult == DialogResult.No)
                {
                    // We ain't doing shit.
                }
            }
            else
            {
                MessageBox.Show("ERROR: Your user-group does not have sufficient rights to use the Remote Console.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            sqlFunctions sql = new sqlFunctions();

            if (sql.login(textBox1.Text, textBox2.Text) == true)
            {
                toolStripStatusLabel1.ForeColor = Color.DarkGreen;
                toolStripStatusLabel1.Text      = "Logged In As:";
                toolStripStatusLabel2.Text      = textBox1.Text;
                sqlFunctions    sql2     = new sqlFunctions();
                WebClient       client   = new WebClient();
                string          ip       = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/1.txt");
                string          usr      = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/2.txt");
                string          pw       = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/3.txt");
                string          ip2      = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/4.txt");
                string          usr2     = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/5.txt");
                string          pw2      = client.DownloadString("http://www.merrimentgamestudio.com/smurfrp/srvtool/6.txt");
                MySqlConnection conn2    = new MySqlConnection("server=" + ip + ";userid=" + usr + ";password="******";database=114794-donations");
                MySqlConnection conn4    = new MySqlConnection("server=" + ip + ";userid=" + usr + ";password="******";database=114794-donations");
                MySqlConnection conn3    = new MySqlConnection("server=" + ip2 + ";userid=" + usr2 + ";password="******";database=114794-drpbans");
                MySqlCommand    getauth2 = new MySqlCommand("SELECT * FROM users WHERE username = '******';");
                MySqlCommand    getauth4 = new MySqlCommand("SELECT * FROM users");
                MySqlCommand    getauth3 = new MySqlCommand("SELECT * FROM u_globalbans");
                getauth2.Parameters.AddWithValue("username", textBox1.Text);
                getauth2.Connection = conn2;
                getauth3.Connection = conn3;
                getauth4.Connection = conn4;
                conn2.Open();
                conn3.Open();
                conn4.Open();
                MySqlDataReader Reader2 = getauth2.ExecuteReader();
                MySqlDataReader Reader3 = getauth3.ExecuteReader();
                MySqlDataReader Reader4 = getauth4.ExecuteReader();
                // Set 'last login'
                sql.writeLastLogin(DateTime.Now.ToString(), textBox1.Text);

                // Lastly, set form title
                this.Text = ("SmurfRP Server Tool :: " + textBox1.Text);

                // Hide login panel
                panel1.Visible = false;

                // Show logout panel
                panel10.Visible = true;

                while (Reader2.Read())
                {
                    // Set some shit.
                    pictureBox2.ImageLocation = (sql.GetDBString("avatar", Reader2));
                    label7.Text    = textBox1.Text;
                    label9.Text    = (sql.GetDBString("registerdate", Reader2));
                    label10.Text   = (sql.GetDBString("lastlogin", Reader2));
                    label15.Text   = "You Last Logged In: " + (sql.GetDBString("lastlogin", Reader2));
                    textBox6.Text  = (sql.GetDBString("avatar", Reader2));
                    label13.Text   = "Logged in as " + textBox1.Text;
                    panel7.Visible = true;

                    button6.Enabled = true;
                    button7.Enabled = true;
                    button8.Enabled = true;

                    // Show Ban Label
                    label24.Visible = true;

                    // Remember User?
                    if (checkBox1.Checked == true)
                    {
                        using (StreamWriter sw = File.CreateText("lastuser.txt"))
                        {
                            sw.WriteLine(textBox1.Text);
                        }
                    }
                    else
                    {
                        if (File.Exists("lastuser.txt"))
                        {
                            File.Delete("lastuser.txt");
                        }
                    }
                }

                while (Reader4.Read())
                {
                    // Populate the new tab with even more shit!
                    ListViewItem userlist;
                    userlist = new ListViewItem(Reader4.GetString("username"));
                    userlist.SubItems.Add(Reader4.GetString("registerdate"));
                    userlist.SubItems.Add(sql.GetDBString("lastlogin", Reader4));
                    userlist.SubItems.Add(Reader4.GetString("isadmin"));
                    userlist.SubItems.Add(Reader4.GetString("canuseremote"));
                    userlist.SubItems.Add(Reader4.GetString("isbanned"));
                    listView2.Items.Add(userlist);
                }


                while (Reader3.Read())
                {
                    ListViewItem item;
                    item = new ListViewItem(Reader3.GetString("_SteamID"));
                    item.UseItemStyleForSubItems = false;
                    if (Reader3.IsDBNull(1) == true)
                    {
                        item.SubItems.Add("Unknown", Color.Maroon, Color.White, new Font(label1.Font.Name, 8.0F, FontStyle.Bold));
                    }
                    else
                    {
                        item.SubItems.Add(Convert.ToString(Reader3.GetValue(1)));
                    }
                    if (Reader3.GetString("_Reason") == "")
                    {
                        item.SubItems.Add("No Reason Given", Color.Gray, Color.White, new Font(label1.Font.Name, 8.0F, FontStyle.Italic));
                    }
                    else
                    {
                        item.SubItems.Add(Reader3.GetString("_Reason").Replace(@"\", ""));
                    }

                    if (Reader3.GetString("_Length") == "0")
                    {
                        item.SubItems.Add("Permanently", Color.Maroon, Color.White, new Font(label1.Font.Name, 8.0F, FontStyle.Bold));
                    }
                    else
                    {
                        TimeSpan t2 = TimeSpan.FromSeconds(Convert.ToDouble(Reader3.GetString("_Length")));


                        item.SubItems.Add(string.Format("{0:D2}h {1:D2}m {2:D2}s",
                                                        t2.Hours,
                                                        t2.Minutes,
                                                        t2.Seconds));
                    }


                    TimeSpan t = TimeSpan.FromSeconds(Convert.ToDouble(Reader3.GetString("_Time")));


                    item.SubItems.Add(string.Format("{0:D2}h {1:D2}m {2:D2}s",
                                                    t.Hours,
                                                    t.Minutes,
                                                    t.Seconds));



                    item.SubItems.Add(Reader3.GetString("_ASteamName"));
                    item.SubItems.Add("lol");
                    listView1.Items.Add(item);
                }
                Reader2.Close();
                conn2.Close();
                Reader3.Close();
                conn3.Close();
                conn4.Close();
                Reader4.Close();
                label24.Text = ("Total Bans: ") + listView1.Items.Count.ToString();
            }
            else
            {
                label4.Text    = "Authentication Failed. Check Username/Password.";
                label4.Visible = true;
            }
        }