Created
July 2, 2015 10:57
-
-
Save tuefekci/eb25a4cc54ccf74f4da7 to your computer and use it in GitHub Desktop.
Timelog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('UTC'); | |
$file = "timelog/timelog_".date("Y_m_d").".csv"; | |
$args = $argv; | |
$now = date("Y-m-d H:i:s"); | |
if(file_exists($file)) { | |
$content = file_get_contents($file); | |
} else { | |
$content = ""; | |
} | |
if($args['1'] == "start") { | |
$content .= "Start;".$now."\r\n"; | |
echo "Tracking Started!"; | |
}elseif($args['1'] == "stop") { | |
$content .= "Stop;".$now."\r\n"; | |
echo "Tracking Stopped!"; | |
} | |
file_put_contents($file, $content); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment