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 


Need Help with database

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

Joined: 06 Aug 2020
Posts: 1

PostPosted: Thu Aug 06, 2020 10:36 am    Post subject: Need Help with database Reply with quote

I wanna make user count for my cheat engine trainer online users would be cool too. Can someone tell me how I can do that I dont need login or register forms just usercount
Back to top
View user's profile Send private message
daspamer
Grandmaster Cheater Supreme
Reputation: 54

Joined: 13 Sep 2011
Posts: 1588

PostPosted: Thu Aug 06, 2020 1:18 pm    Post subject: Reply with quote

Look for some online counter script that can tell you how many users are in your website or blog, use getInternet().getURL('your website') and parse results, that is assuming the counter script is not javascript based, but rather like included php script.

here's an example without using site which should suit your needs, hopefully won't bother the service provider.

Code:
local gi = getInternet();
t = createTimer();
t.interval = 10000 -- every 10 secs
t.onTimer = function(sender)
   local response = gi.getURL('http://freehostedscripts.net/ocounter.php?site=5644621&e1=Online%20User&e2=Online%20Users&r=0&m=0&wh=1024%20x%20768&a=1&pn=http://somenonexistent.site.com');
   if (response) then
       local users = response:match('>(%d+ Online Users?)</a>');
       print(users);
   end

end

_________________
I'm rusty and getting older, help me re-learn lua.
Back to top
View user's profile Send private message Visit poster's website
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8585
Location: 127.0.0.1

PostPosted: Sun Aug 09, 2020 8:23 pm    Post subject: Reply with quote

If you want something accurate you will need to track sessions in some manner. No login/auth would be required for this. Think of it as a basic analytics setup where you'd want to track usage/interactions with your trainer.

Create a website that has some API exposed, for this you'd only really need 1 endpoint and then some server-sided processing/cron job to deal with stale information depending on how you store it.

Something on the lines of:
https://yourwebsite.com/api/heartbeat

When the user starts the trainer, it makes a connection to the above URL. (For better stats, ideally you'd send some POST data with it, mainly the trainer id to track just that trainer specifically if you want to do this for multiple programs.) When that connection is made, the server would create a session with their IP, trainer id and any extra data you want to collect/link to their session. Give the session a TTL (time to live) of like 2-10 minutes, and a cron job that will auto-delete any stale sessions that have not been updated. (ie. if storing in a SQL database, just have it look for expired stuff based on a timestamp.)

While the trainer is running, have it connect to 'https://yourwebsite.com/api/heartbeat' every minute or so to refresh their session time. (In this case, the server would first look for an existing session matching their IP and other POST data like the trainer id. If a session exists, update the timestamp. If not, make a new session.)

You can have the API return the current count of users that are connecting to the API with the same trainer information to do it all in a single endpoint.

SQL wise, you could do something as basic as a table with:
- The users IP
- The timestamp the session was created.
- The timestamp the session was last updated.
- The unique trainer id given to the trainer.

Then you can just do a simple SELECT COUNT(*) query to pull a total of people using a given trainer based on its id and a valid timestamp.

The cron job can cleanup stale stuff every ~10min or so depending on how urgent your database grows etc.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine 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