Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


MYSql

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
GrowhaxxYT
How do I cheat?
Reputation: 0

Joined: 19 Nov 2018
Posts: 8

PostPosted: Thu Apr 30, 2020 1:55 am    Post subject: MYSql Reply with quote

How do i make form in cheat engine that has login and register using MYSql?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

Joined: 09 May 2003
Posts: 25875
Location: The netherlands

PostPosted: Thu Apr 30, 2020 2:40 am    Post subject: Reply with quote

learn how to use php first

also, do you understand sql and sql queries? Asking since we often get people here for "MySQL login" because they read somewhere that that's "The way it's normally done" but have absolutely no clue how to even setup a database system

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
GrowhaxxYT
How do I cheat?
Reputation: 0

Joined: 19 Nov 2018
Posts: 8

PostPosted: Thu Apr 30, 2020 2:45 am    Post subject: Reply with quote

I do know stuffs about mysql the only thing i dont know is how to make php so thanks!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

Joined: 09 May 2003
Posts: 25875
Location: The netherlands

PostPosted: Thu Apr 30, 2020 3:00 am    Post subject: Reply with quote

an example php script: (note, add some sanity/safety checks yourself)
Code:


$username=$_POST['username']; //use $_GET[] if you wish to experiment with the url manually in the addressbar
$password=$_POST['password'];

$db = new mysqli('localhost', 'databaseusername', 'databasepassword', 'databasename');

$stmt = $cdb->prepare("SELECT password from userdatabase where username=?");
$stmt->bind_param("s",$username);
$correctpassword='';
$stmt->result("s",$correctpassword);
if (!$stmt->execute())
  die('sql error');

if ($stmt->fetch())
{
   if ($password != $correctpassword)
   {
      die('invalid username or password');
   }

  $stmt->close();
  //everything ok, setup a session for this user
  //do stuff
  echo("Correct"); //if you don't care about sessions just reply Correct and let your lua script check if the result is "Correct"
}
else
  die('invalid username or password'); //actually username but don't tell them



I take it you do already have a host with php support? (You can always use your own computer and dyndns stuff)

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
GrowhaxxYT
How do I cheat?
Reputation: 0

Joined: 19 Nov 2018
Posts: 8

PostPosted: Thu Apr 30, 2020 3:34 am    Post subject: Reply with quote

ye i already have a host
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Apr 30, 2020 6:29 am    Post subject: Reply with quote

DB, how if not using PHP to creating a connection to the SQL database?.

In LuaSQL should be something like this:

Code:
require "luasql.mysql"
env = assert (luasql.mysql())
con = assert (env:connect"my_db")


or in VB

Code:
Public Class MY_CONNECTION

    Private connection As New MySqlConnection("server=127.0.0.1;user id=root;persistsecurityinfo=True;database=vbnet_users_db2;port=3306;password=")

    ReadOnly Property getConnection() As MySqlConnection
        Get
            Return connection
        End Get
    End Property

    Sub openConnection()
        If connection.State = ConnectionState.Closed Then
            connection.Open()
        End If
    End Sub

    Sub closeConnection()
        If connection.State = ConnectionState.Open Then
            connection.Close()
        End If
    End Sub

End Class


How if use CE Lua script to get connection to MySQL database?

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 472

Joined: 09 May 2003
Posts: 25875
Location: The netherlands

PostPosted: Thu Apr 30, 2020 6:54 am    Post subject: Reply with quote

first setup a ODBC connection for mysql and then use createODBCConnection() and set it up accordingly

alternatively you can use a local database file in sqlite3 and connect to it with createSQLite3Connection

then you can use the sql components to query/update the database

Again I must state that you should NEVER let a client (like CE lua script) issue sql queries on your online database directly because the user can edit the sql query and change it to one that's not that good
e.g:
Code:

drop database

or
Code:

update users where username='myname' set admin=1

or
Code:

select fuckingcleartextpassword from users where username='adminuser'

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Thu Apr 30, 2020 7:18 am    Post subject: Reply with quote

Dark Byte wrote:
Again I must state that you should NEVER let a client (like CE lua script) issue sql queries on your online database directly because the user can edit the sql query and change it to one that's not that good


Thanks. DB for info, then for the security reason it's better using PHP script which stores on a web host and access it from CE Lua script OR creating an HTML user login page + PHP. The last one I think is better.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites