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 8772357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:00:57+00:00 2026-06-13T18:00:57+00:00

hey guys i’m running a script on my site: as a user logs into

  • 0

hey guys i’m running a script on my site:
as a user logs into my website i write this days date into a text file so i can know at witch days the user was active on my website.
the thing is, if a user lets say didn’t log out from the site for 2 days or more how can i check if he was on the site on those days? can some one give me a good suggestion?

here is the code i’m running as part of my login, just before i register the session: (by the way ill be glad to hear if there’s a better way to do it?)

      $log_file_name = "logfile.txt";
      $log_file_path = "log_files/$id/$log_file_name";

      if(file_exists($log_file_path)){
      $not = "";
      $todaydate = date('d,m,Y');
      $today = "$todaydate;";
      $strlength = strlen($today);
      $file_contents = file_get_contents($log_file_path);
      $file_contents_arry = explode(";",$file_contents);
      if(!in_array($todaydate,$file_contents_arry)){
      $append = fopen($log_file_path, 'a');
      $write = fwrite($append,$today); //writes our string to our file.
      $close = fclose($append); //closes our file    
      }
      else if(in_array($todaytodaydate,$file_contents_arry)){}



      }
      else{
      mkdir("log_files/$id", 0700);
      $todaydate = date('d,m,Y');
      $today = "$todaydate;";
      $strlength = strlen($today);
      $create = fopen($log_file_path, "w");
      $write = fwrite($create, $today, $strlength); //writes our string to our file.
      $close = fclose($create); //closes our file
      }
  • 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-13T18:00:57+00:00Added an answer on June 13, 2026 at 6:00 pm

    This isn’t something for a text-file to handle (as you will end up with hundreds of text-files), This should be handled with a database, and a set of Update Queries.

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

Sidebar

Related Questions

Hey guys I've written this MS SQL script with my awesome MS SQL skills,
Hey guys i've been stuck on this problem for 2 days in a row,
Hey Guys I'm running this little function here function getBeaches() { $request=Slim::getInstance()->request(); $args=filter_var_array(func_get_args(),FILTER_SANITIZE_STRING); $sql=SELECT
Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
hey guys having this really simple problem but cant seem to figure out have
Hey guys I managed to get a text input and select box to updated
Hey Guys I've been struggling with this for the last hour and pouring over
Hey guys I'm building my first website and I cannot figure how to get
Hey guys im using this Devise model : https://github.com/plataformatec/devise/wiki/How-To%3a-Require-admin-to-activate-account-before-sign_in do anyone know where i
Hey guys this is pretty simple - I ran across a cool MVC example

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.