Jump to content

Search the Community

Showing results for tags 'file write'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hello everyone, Drama booking site that I made, is doing good now, thanks to you all guys for making it possible. Sometimes users report that they couldn't buy ticket due to some problem, we need to check where they ran into problem. Also, I need to save a log for every successful or failed transaction. I'm doing it with a txt file which is generated by following code: //Logging User Activity function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((int)$usec + (int)$sec); } $filename = $config->urls->template."activity/".$user.".txt"; if (file_exists($filename)) { $handle = fopen($filename, 'a') or die('Cannot open file: '.$filename); //implicitly creates file $new_data = "\nPage Name: {$page->url} \nTime Stamp: ".date('d/M/Y h:i:s A')."\nUser Agent: ".$_SERVER['HTTP_USER_AGENT']."\nIP Address: ".$_SERVER['REMOTE_ADDR']."\n============================"; fwrite($handle, $new_data.PHP_EOL); } else { $log_file = "activity/".$user.".txt"; $handle = fopen($log_file, 'w') or die('Cannot open file: '.$log_file); //implicitly creates file $data = "UserName = {$user->u_fullname}\nPage Name: {$page->url} \nTime Stamp: ".date('d/M/Y h:i:s A')."\nUser Agent: ".$_SERVER['HTTP_USER_AGENT']."\nIP Address: ".$_SERVER['REMOTE_ADDR']."\n============================"; fwrite($handle, $data); } fclose($handle); //End of Logging Code The file that is generated shows output as follows: Page Name: /dramas/white-lily-aani-knight-rider/ Time Stamp: 30/Oct/2013 06:41:58 PM User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36 IP Address: 127.0.0.1 ============================ Page Name: /404-page-not-found/ Time Stamp: 30/Oct/2013 06:41:59 PM User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36 IP Address: 127.0.0.1 ============================ Page Name: /404-page-not-found/ Time Stamp: 30/Oct/2013 06:43:10 PM User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36 IP Address: 127.0.0.1 ============================ Page Name: /dramas/white-lily-aani-knight-rider/ Time Stamp: 30/Oct/2013 06:43:21 PM User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36 IP Address: 127.0.0.1 ============================ Page Name: /404-page-not-found/ Time Stamp: 30/Oct/2013 06:43:22 PM User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36 IP Address: 127.0.0.1 ============================ As you can see there are 404 records after every page visit. I don't know why it is happening, while browsing the site there are certainly no 404 errors. Also for each visit, the file shows two records, an actual page record & other 404. Anyone knows why is it happening?
×
×
  • Create New...