Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8729535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:51:05+00:00 2026-06-13T08:51:05+00:00

I’ve developed a server-client application based on the following idea: A Client (windows application)

  • 0

I’ve developed a server-client application based on the following idea:

A Client (windows application) work with a Server (PHP webpages) mostly like a client-server application based on sockets. Client send raw data to a PHP webpage, PHP script will check/process received data and finally script return an answer to client (data accepted/rejected/etc.).

The basic idea is that the client “ping” the server every X seconds even there the client is active or not. What is the best solution to log client activity?
For example:

Client1 started application at Time1       and it "ping" Server for lets say 30 minutes, after that interval the Server stop receiving "pings" from the client;
Client2 started application at Time1+10min and it "ping" Server for lets say 40 minutes, after that interval the Server stop receiving "pings" from the client;
Client1 started application at Time1+35    and it "ping" Server for lets say 60 minutes, after that interval the Server stop receiving "pings" from the client;

** Server stop receiving "pings" from client means there is no activity for at least 1 minute

I need a final report who can give me the following data:

Client   |  Start at   |    End at   | Active
=========+=============+=============+========
Client1  | Time1       | Time1+30min | 30min 
Client2  | Time1+10min | Time1+50min | 40min 
Client1  | Time1+35min | Time1+95min | 60min 

I don’t have any clue how to make my MySQL log tables and what information to store in them via PHP for future reports.

Any questions/observations are welcome.

EDIT: I don’t need any PHP code to log my entryes, I don’t need MySQL CREATE TABLE or SELECT command from you. I just ask for a good way to store all records, and a good way to retrieve some information from them. Thanks for downvoting the post without reading it until the end.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:51:05+00:00Added an answer on June 13, 2026 at 8:51 am

    @MoeTsao’s suggestion is not bad, considering you didn’t define the “X” in “X seconds”. If “X” was around 3600 or more, it wouldn’t be too bad. Maybe you got downvoted for being pissy to him instead of taking his idea and modifying based on your (now elaborated) value of “X”? As in…

    Create a log table like this:

     client_id
     start_time
     end_time
    

    then, on every request, do an UPDATE:

     update log_table
     set end_time = NOW()
     where client_id = $client_id
     and start_time >= date_sub(now(), interval 1 minute)
    

    Check how many rows were updated (see your coding manual for that).

    If one row was updated, you’re done. If none were updated, it’s either a new client or a client that is idle and you must then do an insert:

     insert into log_table (client_id, start_time, end_time)
     values ($client_id, now(), now())
    

    (contrary to my pseudo-code, please use positional parameters in your queries).

    Creating the report is trivial (all necessary columns are in the row you’re storing), and is left as an exercise for the original poster. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to count the length of a string with PHP. The string
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.