#include <iostream>
#include <mysql_driver.h>
#include <mysql_connection.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <windows.h>
void checkHWIDAndCloseIfNotFound(const std::string& hwid) {
try {
sql::mysql::MySQL_Driver* driver;
sql::Connection* con;
sql::PreparedStatement* pstmt;
sql::ResultSet* res;
// Connect to the database
driver = sql::mysql::get_mysql_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "user", "password"); // Replace with your database details
con->setSchema("your_database_name"); // Replace with your database name
// Prepare and execute statement
pstmt = con->prepareStatement("SELECT * FROM your_table WHERE hwid = ?");
pstmt->setString(1, hwid);
res = pstmt->executeQuery();
// Check if HWID is found
if (!res->next()) {
MessageBox(NULL, "HWID not found. Closing application.", "Error", MB_ICONERROR);
// Close the cheat and ks2 here
exit(1); // or use appropriate exit code
}
delete res;
delete pstmt;
delete with;
} catch (sql::SQLException& e) {
std::cerr << "SQLException: " << e.what();
// Handle exception
}
}
int main() {
std::string hwid = "your_hwid_here"; // Replace with the method to get HWID
checkHWIDAndCloseIfNotFound(hwid);
// Rest of your code
return 0;
}