Post: C# SQL Member Verrification
08-31-2014, 02:48 PM #1
04jberry
whoo piece of candy!!!
(adsbygoogle = window.adsbygoogle || []).push({}); Step 1. you need an sql server i use the sql server for my site or either host it yourself i use to use whamp

Step 2. you need to set up a user account on the sql server, some web hosting ask you to make an account and assign it to a certain part of the server also theres should be somthing to do with allowed connections just put "%" in the box instead of an ip address withought the quotesand you need to create 3 columbs in the database do the same as below.

Name: userid
Type: int(10) unsigned

Name: username
Type: varchar(100)

Name: password
Type: char(32)

Step 3. once you have set up the database enter some details in the colum for e.g 1, myuser101, mypass101

Step 3a. download this dll You must login or register to view this content. and add
using MySql;
using MySql.Data;
using MySql.Data.MySqlClient;
thanks to Citadel for the reminder Smile

Step 4. use this code in your tool put it on login button just change the details to your server.
    try
{
string myConnection = "datasource=Server_Here;port=3306;username=Username_Here;password=Password_Here;";
MySqlConnection myConn = new MySqlConnection(myConnection);

MySqlCommand selectcommand = new MySqlCommand("select * from Database_Name_Here.Table_Name_Here where username='" + this.username_txt.Text + "' and password='" + this.password_txt.Text + "' ;", myConn);


MySqlDataReader myReader;
myConn.Open();
myReader = selectcommand.ExecuteReader();
int count = 0;
while (myReader.Read())
{
count = count + 1;
}
if (count == 1)
{
MessageBox.Show("Thank You for Loging in");
ConnectBut.Enabled = true;
CCAPIRB.Enabled = true;
TMapiRB.Enabled = true;
username_txt.Enabled = false;
password_txt.Enabled = false;
button1.Enabled = false;
NAA.Enabled = false;

}
else if (count > 1)
{
MessageBox.Show("Theres 2 Users with that username Please contact Your_Name_Here ...Access Denied");
}
else
MessageBox.Show("Username or Password is Not correct .. Please try Again!");

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}


Step 5. create 2 textboxes and change the name to username_txt and the other to password_txt

Also. if you want to press enter and it press the login button whilst on your password textbox then use this code
    private void password_txt_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
this.button1.PerformClick();

}
}


Any questions just ask.
(adsbygoogle = window.adsbygoogle || []).push({});
08-31-2014, 07:00 PM #2
Citadel
Samurai Poster
Originally posted by 04jberry View Post

Any questions just ask.

Suggest a good site(I would do free ones since most people won't pay for one Happy)

They need the mysql dll too. You must login or register to view this content.
Pretty sure you'll need

using MySql;
using MySql.Data;
using MySql.Data.MySqlClient;

The following user thanked Citadel for this useful post:

04jberry
08-31-2014, 09:02 PM #3
04jberry
whoo piece of candy!!!
Originally posted by Citadel View Post
Suggest a good site(I would do free ones since most people won't pay for one Happy)

They need the mysql dll too. You must login or register to view this content.
Pretty sure you'll need

using MySql;
using MySql.Data;
using MySql.Data.MySqlClient;


only problem is, is that all the free one's don't support remote access hence the need to pay you can make your tool login to a website though and check the webpage for the words "Log out" to comfirm they have logged in and thanks for reminding me ill add in the dll to the instructions
09-21-2014, 10:45 AM #4
Originally posted by 04jberry View Post
only problem is, is that all the free one's don't support remote access hence the need to pay you can make your tool login to a website though and check the webpage for the words "Log out" to comfirm they have logged in and thanks for reminding me ill add in the dll to the instructions


I played arround with C# / PHP for SQL Member Verrification.
It works on free hoster too.

I have release my simple Coding.



You can find all information in the description of the video.

Cheers ...
09-22-2014, 07:03 AM #5
Default Avatar
Oneup
Guest
Originally posted by 04jberry View Post
Step 1. you need an sql server i use the sql server for my site or either host it yourself i use to use whamp

Step 2. you need to set up a user account on the sql server, some web hosting ask you to make an account and assign it to a certain part of the server also theres should be somthing to do with allowed connections just put "%" in the box instead of an ip address withought the quotesand you need to create 3 columbs in the database do the same as below.

Name: userid
Type: int(10) unsigned

Name: username
Type: varchar(100)

Name: password
Type: char(32)

Step 3. once you have set up the database enter some details in the colum for e.g 1, myuser101, mypass101

Step 3a. download this dll You must login or register to view this content. and add
using MySql;
using MySql.Data;
using MySql.Data.MySqlClient;
thanks to Citadel for the reminder Smile

Step 4. use this code in your tool put it on login button just change the details to your server.
    try
{
string myConnection = "datasource=Server_Here;port=3306;username=Username_Here;password=Password_Here;";
MySqlConnection myConn = new MySqlConnection(myConnection);

MySqlCommand selectcommand = new MySqlCommand("select * from Database_Name_Here.Table_Name_Here where username='" + this.username_txt.Text + "' and password='" + this.password_txt.Text + "' ;", myConn);


MySqlDataReader myReader;
myConn.Open();
myReader = selectcommand.ExecuteReader();
int count = 0;
while (myReader.Read())
{
count = count + 1;
}
if (count == 1)
{
MessageBox.Show("Thank You for Loging in");
ConnectBut.Enabled = true;
CCAPIRB.Enabled = true;
TMapiRB.Enabled = true;
username_txt.Enabled = false;
password_txt.Enabled = false;
button1.Enabled = false;
NAA.Enabled = false;

}
else if (count > 1)
{
MessageBox.Show("Theres 2 Users with that username Please contact Your_Name_Here ...Access Denied");
}
else
MessageBox.Show("Username or Password is Not correct .. Please try Again!");

}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}


Step 5. create 2 textboxes and change the name to username_txt and the other to password_txt

Also. if you want to press enter and it press the login button whilst on your password textbox then use this code
    private void password_txt_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)13)
{
this.button1.PerformClick();

}
}


Any questions just ask.

You should be using parameters when allowing a user to query the database otherwise you are going to have some problems with injections.
09-22-2014, 10:25 AM #6
fill0botto95
You talkin to me?
Originally posted by 1UP View Post
You should be using parameters when allowing a user to query the database otherwise you are going to have some problems with injections.


This. To test it, just use a quote char in one of those fields.
I suggst to lear some basis of PHP and code a server side, more secure.
09-22-2014, 01:15 PM #7
Default Avatar
Oneup
Guest
Originally posted by fill0botto95 View Post
This. To test it, just use a quote char in one of those fields.
I suggst to lear some basis of PHP and code a server side, more secure.


It would probably be better to keep everything on the sql server. You can create stored procedures on the sql server so no matter what you are passing in parameterized values.

So something like this:
    
Dim sql As String = "CALL GetUserID('" & txt_UserName.Text & "','" & generalFunctions.md5(txt_Password.Text, txt_UserName.Text) & "'Winky Winky"
09-23-2014, 12:20 AM #8
Storing passwords and sensitive data is plain text is bad programming. Look into hashing passwords.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo