Results 1 to 14 of 14
  1. #1
    kBob's Avatar
    Join Date
    Jun 2011
    Gender
    male
    Posts
    87
    Reputation
    10
    Thanks
    2
    My Mood
    Relaxed

    Login script using remote database

    Hello

    This is a TUT for forum admins out there (mainly) but can be used for others.

    This connects to a remote database. I've modified a default code that many other users have used. I made it faster in the process of logging in.

    First download this: MySQL :: Download Connector/Net

    Second import MySQL.Data from .NET Reference


    Third, type in at the top of your code "Imports MySQL.Data.mysqlclient"


    At the top of your form, dim a new MySQL Connector or:


    Next on your form Startup or Load Declarations code, type in this:
    Code:
    conn = New MySqlConnection()
            conn.ConnectionString = "server=SERVER URL or IP; user id=DATABASE USER; password=DB PASS; database=DATABASE NAME"
            Try
                conn.Open()
            Catch myerror As MySqlException
                MsgBox("Error attempting to connect to server. The Mark M Server may be down.")
                Me.Close()
            End Try
    Modify to your info

    Next make two textboxes and 1 button (2 if you want one for exit)

    Make the button say "LOGIN" and password textbox properties:


    Double click the OK or LOGIN button and type this code (modify to your needs)

    Code:
    Dim myAdapter As New MySqlDataAdapter
                    Dim sqlquery = "SELECT * FROM TABLE_HERE WHERE USERNAME_FIELD_HERE='" + TextBox1.Text + "' AND PASSWORD_FIELD_HERE'" + TextBox2.Text + "'"
                    Dim myCommand As New MySqlCommand()
                    myCommand.Connection = conn
                    myCommand.CommandText = sqlquery
                    'start query
                    myAdapter.SelectCommand = myCommand
                    Dim myData As MySqlDataReader
                    myData = myCommand.ExecuteReader()
                    'see if user exits.
                    If myData.HasRows = 0 Then
                        conn.Close()
                        conn.Open()
                        MsgBox("Wrong username or Password", MsgBoxStyle.Critical, "Error")
                    Else
                        Main.Show()
                        Me.Close()
                    End If
                End If
    Sorry ill modify it later(add explanation) i did this at 10 PM so i dont have much time

    Thank me if this helped!

    NOTE: YOU CAN TRY SSL IF YOUR WEBSITE SUPPORTS IT BUT I NEVER TRIED IT
    Last edited by kBob; 09-14-2011 at 08:22 PM.

  2. #2
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    This is a bad practice. Although having a mysql adapter is nice in theory, it's terrible for security. Because you're storing your usename/password/server in the exe, reversers can easily steal that info by dissembling your program. Even obfuscating doesn't solve the problem.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  3. #3
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Quote Originally Posted by Jason View Post
    This is a bad practice. Although having a mysql adapter is nice in theory, it's terrible for security. Because you're storing your usename/password/server in the exe, reversers can easily steal that info by dissembling your program. Even obfuscating doesn't solve the problem.
    True. The MySQL adapter is terrible if you want to publish your application.

    You should rather use PHP.



  4. The Following User Says Thank You to Blubb1337 For This Useful Post:

    AceKill3r (09-16-2011)

  5. #4
    qwerty01's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    180
    Reputation
    9
    Thanks
    225
    My Mood
    Lurking
    Quote Originally Posted by Blubb1337 View Post
    True. The MySQL adapter is terrible if you want to publish your application.

    You should rather use PHP.
    actually not really...then anyone can just access the webpage and modify the database

    make them type the password every time -- you can't reverse what isn't stored

  6. #5
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by qwerty01 View Post
    actually not really...then anyone can just access the webpage and modify the database

    make them type the password every time -- you can't reverse what isn't stored
    You can still reverse the connection string. And who said you can change the database through any PHP page lawl? Have the query pre-written in the page, and return the results. Or require a validation on the PHP page

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  7. #6
    qwerty01's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    180
    Reputation
    9
    Thanks
    225
    My Mood
    Lurking
    Quote Originally Posted by Jason View Post


    You can still reverse the connection string. And who said you can change the database through any PHP page lawl? Have the query pre-written in the page, and return the results. Or require a validation on the PHP page
    from what i inferred, he was suggesting to use php as a middleman for the queries, so you could easily do any query just by going to the php page (as it wouldn't require a password)

    and i don't think any hacker's going to get much out of
    Code:
    conn.ConnectionString = "server="+txtServer.text+"; user id="+txtUser.text+"; password="+txtPass.text"; database="+txtDatabase.text
    OP implies that you know the user and pass of the database, as this is designed for forum admins (and it expects you to know the password, etc)

    EDIT:
    modifying the database = modifying the contents of the database
    modifying != changing
    Last edited by qwerty01; 09-19-2011 at 06:06 PM.

  8. #7
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by qwerty01 View Post
    EDIT:
    modifying the database = modifying the contents of the database
    modifying != changing
    Changing is definitely what modifying means lol. I suggest you get your hands on a good dictionary.

    Define: Modifying

    And making the user have to specify each aspect of the connection string...how is that a feasible solution? Congrats, your application no longer has any distributivity.
    Last edited by Jason; 09-19-2011 at 06:42 PM.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  9. #8
    qwerty01's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    180
    Reputation
    9
    Thanks
    225
    My Mood
    Lurking
    Quote Originally Posted by Jason View Post

    Changing is definitely what modifying means lol. I suggest you get your hands on a good dictionary.

    Define: Modifying
    ...
    If you want to get into grammar...

    if i wanted to change the database i would have said changing the database
    however here modifying is applied to the database itself
    Changing: Make or become different
    Modifying: Make partial or minor changes to (something), typically so as to improve it or to make it less extreme.
    Database: A structured set of data held in a computer, esp. one that is accessible in various ways.
    so therefore changing the database would be changing the current database in use, and modifying the database would be changing the data inside the current database

    Changing:
    Code:
    USE [...]
    Modifying: (assuming a DB is already selected)
    Code:
    UPDATE [...]
    Quote Originally Posted by Jason View Post

    ...
    And making the user have to specify each aspect of the connection string...how is that a feasible solution? Congrats, your application no longer has any distributivity.
    Functionality. This is designed for forum admins, so they should know the user/pass/database
    and as it's being distributed to forum admins, there is no reason to force them to make their own php page, or hard code in a password
    if it were me i would add something that would give the option to save the password (using security through obscurity to prevent most people from finding the password), so that they're not forced to type it in all the time, or compromise their password by saving it if they feel that security through obscurity isn't enough

  10. #9
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by qwerty01 View Post
    If you want to get into grammar...

    if i wanted to change the database i would have said changing the database
    however here modifying is applied to the database itself




    so therefore changing the database would be changing the current database in use, and modifying the database would be changing the data inside the current database

    Changing:
    Code:
    USE [...]
    Modifying: (assuming a DB is already selected)
    Code:
    UPDATE [...]


    Functionality. This is designed for forum admins, so they should know the user/pass/database
    and as it's being distributed to forum admins, there is no reason to force them to make their own php page, or hard code in a password
    if it were me i would add something that would give the option to save the password (using security through obscurity to prevent most people from finding the password), so that they're not forced to type it in all the time, or compromise their password by saving it if they feel that security through obscurity isn't enough
    Lol "changing" in my context wasn't changing the database in use, it was changing the data . And who says that MySQL connection is just for forum admins, if that's all you use MySQL for that's your own business, but isn't a restriction on all people who use MySQL, so a hardcoded connection string will have to be used. Gawd dammit.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  11. #10
    qwerty01's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    180
    Reputation
    9
    Thanks
    225
    My Mood
    Lurking
    Quote Originally Posted by Jason View Post


    Lol "changing" in my context wasn't changing the database in use, it was changing the data . And who says that MySQL connection is just for forum admins, if that's all you use MySQL for that's your own business, but isn't a restriction on all people who use MySQL, so a hardcoded connection string will have to be used. Gawd dammit.
    it was changing the database in your context (as there was no way to tell otherwise), and therefore that's how i read your sentence

    Quote Originally Posted by kBob View Post
    Hello

    This is a TUT for forum admins out there (mainly) but can be used for others.
    ...
    the tutorial is designed for forum admins, so in context, it's implied the username and password is known.
    and if you can't edit the connection string to make up for the type of database then you wouldn't be able to put in the username/password required in the first place

  12. #11
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by qwerty01 View Post
    it was changing the database in your context (as there was no way to tell otherwise), and therefore that's how i read your sentence



    the tutorial is designed for forum admins, so in context, it's implied the username and password is known.
    and if you can't edit the connection string to make up for the type of database then you wouldn't be able to put in the username/password required in the first place
    (mainly) but can be used for others.

    Jeebus, please read.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  13. #12
    qwerty01's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    180
    Reputation
    9
    Thanks
    225
    My Mood
    Lurking
    Quote Originally Posted by kBob View Post
    Hello

    This is a TUT for forum admins out there (mainly) but can be used for others.
    he is writing it to the forum admins, but he feels it may be useful to other people, i know how to read.

  14. #13
    Jason's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    /dev/null
    Posts
    5,704
    Reputation
    918
    Thanks
    7,676
    My Mood
    Mellow
    Quote Originally Posted by qwerty01 View Post
    he is writing it to the forum admins, but he feels it may be useful to other people, i know how to read.
    stop contradicting yourself for god's sake. /ignoring this thread from now on.

    Quote Originally Posted by Jeremy S. Anderson
    There are only two things to come out of Berkley, Unix and LSD,
    and I don’t think this is a coincidence
    You can win the rat race,
    But you're still nothing but a fucking RAT.


    ++Latest Projects++
    [Open Source] Injection Library
    Simple PE Cipher
    FilthyHooker - Simple Hooking Class
    CLR Injector - Inject .NET dlls with ease
    Simple Injection - An in-depth look
    MPGH's .NET SDK
    eJect - Simple Injector
    Basic PE Explorer (BETA)

  15. #14
    qwerty01's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    180
    Reputation
    9
    Thanks
    225
    My Mood
    Lurking
    Quote Originally Posted by Jason View Post


    stop contradicting yourself for god's sake. /ignoring this thread from now on.
    when did i contradict myself? ignore it all you want but it's OK to be wrong sometimes

Similar Threads

  1. [Help] Login in using a forum database
    By Shakugan no Shana in forum Visual Basic Programming
    Replies: 10
    Last Post: 06-21-2011, 10:23 PM
  2. How to edit the MAT Automation Script Using Python
    By helmage2 in forum Mission Against Terror Discussions
    Replies: 0
    Last Post: 02-02-2011, 07:36 AM
  3. [Request] Please Upload Cf orginal login script
    By HaxPro in forum CrossFire Mods & Rez Modding
    Replies: 1
    Last Post: 07-24-2010, 10:35 PM
  4. [Help]login script
    By axg24 in forum CrossFire Help
    Replies: 7
    Last Post: 06-09-2010, 07:22 AM
  5. MPGH Login Script(Help)
    By ShadowPwnz in forum Visual Basic Programming
    Replies: 7
    Last Post: 02-21-2010, 08:16 AM