Post: C# Mysql connection tutorial
11-05-2013, 01:01 AM #1
SNMT| Havoc
Do a barrel roll!
(adsbygoogle = window.adsbygoogle || []).push({}); Hey guys SNMT|HACK here and i wanted to show you what i learned

I learned to make a sql connection to a site and a login

Reason im showing this is because mysql is easily the easiest connection to hijack users info.

I WILL NOT TELL ANY WAY OF HACKING THE INFO

You'll need the binary you get if you go under add a resource then .net then find a mysql. You also need the connector which you can get from this site : You must login or register to view this content.

    
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using ProjectWater; //Spoiler of my new rtm tool =D

namespace test_program
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
string MyConString = @"server=SERVER IP OR NAME;userid=USERNAME ON SERVER;password=Password of user;database=The database";

MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand command = connection.CreateCommand();
MySqlDataReader Reader;
command.CommandText = "select * from users";


try
{
connection.Open();
}
catch (Exception ex)
{
MessageBox.Show("There has been an error connecting to the user database! Please try again later.");
}
command.CommandText = "SELECT * FROM users WHERE uname = @username AND password = @password";

//Retrieve row
command.Parameters.AddWithValue("@username", textBox1.Text);
command.Parameters.AddWithValue("@password", textBox2.Text);
Reader = command.ExecuteReader();
try
{
Reader.Read();
string uname = (string)Reader.GetValue(3);
string pword = (string)Reader.GetValue(4);
}
catch (Exception ex)
{
MessageBox.Show("Username or Password incorrect");
return;
}
UInt32 uid = (UInt32)Reader.GetValue(0);
string fname = (string)Reader.GetValue(1);
string lname = (string)Reader.GetValue(2);
string email = (string)Reader.GetValue(5);
string type = (string)Reader.GetValue(6);
string status = (string)Reader.GetValue(7);
string isregistered = (string)Reader.GetValue(Cool Man (aka Tustin);
if (status == "active" && type == "admin" || type == "elite" || type == "staff")
{
MessageBox.Show("Logged in ", "Mw3 mod tool", MessageBoxButtons.OK, MessageBoxIcon.Information);
Form2 fm2 = new Form2();
fm2.Show();
}
else
{
if (status == "banned" || status == "deleted")
{
MessageBox.Show("Unable to log in reason: Account Is Banned");
}

if (type == "normal")
{
MessageBox.Show("Unable to log in reason: Account is not elite");
}
}
}

private void button2_Click(object sender, EventArgs e)
{
this.Close();
}

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("SITE IS PRIVATE FOR NOW Happy");
}

}
}



My table is called users and there are these rows


1. userid (1-unlimited)
2. first name
3. last name
4. user name
5. password
6. email
7. type (admin, elite, staff, normal)
8. status (deleted, banned, active)


- SNMT| HACK
(adsbygoogle = window.adsbygoogle || []).push({});
11-10-2013, 05:50 PM #11
SNMT| Havoc
Do a barrel roll!
Thanks Happy

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo