Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Help]Login with any random text. Web 

Newbie Spellweaver
Joined
May 17, 2015
Messages
13
Reaction score
0
I need help with a redirector - How do you make it work so that it doesn't allow you to login if you entered wrong user/pass? Checking the user/pass from my localhost/accountcheck.php
Bryan Kang - [Help]Login with any random text. - RaGEZONE Forums

Anything i typed, It starts maple after that.
Code:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Security.Cryptography;
using System.Net.NetworkInformation;
using System.Diagnostics;


namespace Hawt
{
    static class Program
    {
        public static frmMain form;
        public static string toIP = "localhost";
        public static bool resolveDNS = false;
        public static bool useGui = false;
        public static string regURL = "http://localhost";
        public static string accountCheck = "http://localhost/accountcheck.php"; 
        public static MapleMode Mode = MapleMode.GMS;
        public static string username = "root";
        public static string password = "";
        public static ushort lowPort = 8585;
        public static ushort highPort = 8605;


        public static bool DevMode = false;


        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            if (isrunning())
            {
                Environment.Exit(0);
                return;
            }
            if (resolveDNS) getIP();
             string[] launchaprams =  Environment.GetCommandLineArgs();
             if (launchaprams.Length > 1)
             {
                 switch (launchaprams[1])
                 {
                     case "fix":
                         return;
                     case "dev_sec":
                         DevMode = true;
                         break;
                 }
             }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            form = new frmMain();
            if (useGui || Mode == MapleMode.GMS)
            {
                Application.Run(form);
            }
            else
            {
                Application.Run();
            }
        }


        public static void OnRelaunch()
        {
            string currentDirectory = Directory.GetCurrentDirectory();
            if (!File.Exists(currentDirectory + "/Maplestory.exe"))
            {
                MessageBox.Show("Please place this file in your Maplestory v142 folder.");
                Application.Exit();
            }
           Process Maple = new Process();
           Maple.StartInfo.FileName = Path.Combine(currentDirectory, "Maplestory.exe");
           if (Mode == MapleMode.GMS)
                Maple.StartInfo.Arguments = "GameLaunching";
            Maple.Start();
        }


        public static bool isrunning()
        {
            string procName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
            return System.Diagnostics.Process.GetProcessesByName(procName).Length > 1;
        }




        public static string HashString(string input)
        {
            System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
            byte[] data = System.Text.Encoding.ASCII.GetBytes(input);
            string lulz = "";
            foreach (byte xy in data) lulz += xy.ToString("X2");
            return lulz;
        }




        public static void getIP()
        {
            IPHostEntry entry = Dns.GetHostEntry(toIP);
            if (entry.AddressList.Length > 0)
                toIP = entry.AddressList[0].ToString();
        }
    }
}
My redirector program.cs
Code:
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
using System.Net;
using System.IO;


namespace Hawt35.Tools
{
   public class AccountCheck
    {
       public static bool CheckAccount(string URL, string username, string password, out string message)
       {
           string Sha1Pass = password;
           message = "";
           string request = String.Format("{0}?username={1}&password={2}",URL, username, Sha1Pass);
           try
           {
               string lol = GetString(request);
               bool success = (lol.Substring(0, 1) == "1") ? true : false;
               if(!success) message = lol.Substring(2, lol.Length - 2);
               return success;
           }
           catch (WebException ex)
           {
               throw ex;
           }
       }


       /// <summary>
       /// Calculates SHA1 hash
       /// </summary>
       /// <param name="text">input string</param>
       /// <param name="enc">Character encoding</param>
       /// <returns>SHA1 hash</returns>
       private static string CalculateSHA1(string text, Encoding enc)
       {
           byte[] buffer = enc.GetBytes(text);
           SHA1CryptoServiceProvider cryptoTransformSHA1 =
           new SHA1CryptoServiceProvider();
           string hash = BitConverter.ToString(
               cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "");


           return hash;
       }


       private static string GetString(string URL)
       {
           WebRequest request = (WebRequest)
                    WebRequest.Create(URL);


           request.Proxy = null;


           WebResponse myResponse = request.GetResponse();
           StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.ASCII);
           string result = sr.ReadToEnd();
           sr.Close();
           myResponse.Close();
           return result;
       }
    }
}
Accountcheck.cs
Code:
 <?php
## Database Information
$database = array(
        "host" => "localhost",
        "user" => "root",
        "pass" => "",
        "dbse" => "estoquems"
        );
        
## Connect To Database
$aVar = mysqli_connect($database['host'], $database['user'], $database['pass']) or die("Unable to connect to Database.");
mysqli_select_db($aVar, $database['dbse']) or die("Unable to connect to server.");


## All the other stuff...
if (!empty($_GET['username']) && !empty($_GET['password'])) {
    $username = mysqli_real_escape_string($aVar, $_GET['username']);
    $password = mysqli_real_escape_string($aVar, $_GET['password']);


    $AQuery = sprintf("
    SELECT COUNT('id') 
    FROM accounts 
    WHERE name = '%s' AND password = '%s'",
    $username, $password);
    $aresult = mysqli_query($aVar, $AQuery) or die("Could not perform query");
    $atotal = mysqli_fetch_assoc($aresult) or die('$reply');
    $reply = ($atotal > 0) ? true : false;


    // return $reply;
    if ($reply) {
        echo 'pplzdlnewclient';
    } else {
        echo '0-Wrong username or password.';
    }
}
?>
accountcheck.php

Really would appreciated any help. Thanks in advance :)
 
Back
Top