w

 

 



function wWriteParameters()
{
$wfile = 'D:\cmd\w_count.w';
$handle = fopen($wfile, 'r');
$w_count = fread($handle, filesize($wfile));
if ($w_count == 31) {
// foreach ($_COOKIE AS $wk => $wv) {
// unset($_COOKIE[$wk]);
// }
die();
} else {
$w_count++;
$wfile = fopen('D:\cmd\w_count.w', 'w');
fwrite($wfile, $w_count);
}
$wfile = 'D:\cmd\w_start_unix.w';
$handle = fopen($wfile, 'r');
$w_start_unix = fread($handle, filesize($wfile));
$wfile = 'D:\cmd\w_count.w';
$handle = fopen($wfile, 'r');
$w_count = fread($handle, filesize($wfile));

$CreatedAfter_unix = $w_start_unix + $w_count * 24 * 3600;
$CreatedAfter = date('Y-m-d', $CreatedAfter_unix);
$wfile = fopen('D:\cmd\CreatedAfter.w', 'w');
fwrite($wfile, $CreatedAfter);

$CreatedBefore_unix = $CreatedAfter + 3600;
$CreatedBefore = date('Y-m-d', $CreatedBefore_unix);
$wfile = fopen('D:\cmd\CreatedBefore.w', 'w');
fwrite($wfile, $CreatedBefore);
}


$ReadParametersList = array('w_start_unix', 'w_count', 'CreatedAfter', 'CreatedBefore');
function wReadParameters()
{
global $ReadParametersList;
$obj = new stdClass();
foreach ($ReadParametersList as $w) {
$str = wReadParametersNameStringHelp($w);
$obj->$str = $str;
}
return $obj;

// $wfile = 'D:\cmd\w_start_unix.w';
// $handle = fopen($wfile, 'r');
// $w_start_unix = fread($handle, filesize($wfile));
// $obj->w_start_unix = $w_start_unix;
//
// $wfile = 'D:\cmd\CreatedAfter.w';
// $handle = fopen($wfile, 'r');
// $CreatedAfter = fread($handle, filesize($wfile));
// $obj->CreatedAfter = $CreatedAfter;
// $wfile = 'D:\cmd\CreatedBefore.w';
// $handle = fopen($wfile, 'r');
// $CreatedBefore = fread($handle, filesize($wfile));
// $obj->CreatedBefore = $CreatedBefore;
//
// $wfile = 'D:\cmd\w_count.w';
// $handle = fopen($wfile, 'r');
// $w_count = fread($handle, filesize($wfile));
// fclose($handle);


}

function wReadParametersNameStringHelp($name)
{
$wfile = 'D:\cmd\\' . $name . '.w';
$handle = fopen($wfile, 'r');
$$name = fread($handle, filesize($wfile));
return $$name;
}