Need help fixing code

<?php //header ('Location: http:www.mydomain.com'); $data = $day.".".$month.".".$year." ".$time; $filename = "log.txt"; $php = fopen($filename, "a"); fwrite($php, $data); fwrite($php, "\r\n"); fclose($php); date_default_timezone_set('UTC'); $day = date('j'); $month = date('m'); $year = date('Y'); $time = date('H:i:s'); //echo "



".$day.".".$month.".".$year." ".$time."

"; ?>

why that dont work?

This line at top not make sense:
[php]$data = $day.".".$month.".".$year." ".$time;[/php]
(because these 3 variables are not defined)

You need to move these 5 lines at top of your script:
[php]date_default_timezone_set(‘UTC’);
$day = date(‘j’);
$month = date(‘m’);
$year = date(‘Y’);
$time = date(‘H:i:s’);[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service