Jump to content

How to modify script so I it will except a time variable instead of current tim?


ghurty

Recommended Posts

As of now, this script works based on the current time. And makes multiple files per time period(based on $maxlines), after exhausting the amount allowed for that ime frame it moves over $callspread time to start again.  I am trying to modify it to work based on a time passed onto it as  $timetostart.

 

What would I change to get it to work (Besides changing to $calltime = $timetostart) . Thanks

 

 

$thisminute = date("i") ;
$calltime = date("Hi",mktime(date("H"),$thisminute+2,0,date("m"),date("d"),date("Y"))) ;
$mincounter = 2 ;

$thisfile = $calltime . $loopcounter .  ".txt" ;

fwrite($fptmp,$txt2write) ;
$txt2write = "test: ". $test. "\n" ;

fclose($fptmp) ;


$tz = getdate();
$tz['hours']   = substr( $calltime, 0, 2 );
$tz['minutes'] = substr( $calltime, 2, 2 );
$time_now = time( );
$time2call = mktime( substr( $calltime, 0, 2 ), substr( $calltime, 2, 2 ), 0, $tz[mon], $tz[mday], $tz[year] );
if ( $time2call <= $time_now )
$time2call += 86400; 

if ($loopcounter == $maxlines) :
$thisminute2 = date("i") ;
if ($thisminute <> $thisminute2) :
  $mincounter = $mincounter + $callspread - 1 ;
else :
  $mincounter = $mincounter + $callspread ;
endif ;
$calltime = date("Hi",mktime(date("H"),$thisminute2+$mincounter,0,date("m"),date("d"),date("Y"))) ;
$thisminute = $thisminute2 ;
$loopcounter = 1 ;
else :
$loopcounter = $loopcounter + 1 ;
endif ;
}
mysql_close($link);

I have narrowed it down to

$thisminute = date("i") ;
$calltime = date("Hi",mktime(date("H"),$thisminute+2,0,date("m"),date("d"),date("Y"))) ;
$mincounter = 2 ;
echo "";

 

and

 

if ($loopcounter == $maxlines) :
$thisminute2 = date("i") ;
if ($thisminute <> $thisminute2) :
  $mincounter = $mincounter + $callspread - 1 ;
else :
  $mincounter = $mincounter + $callspread ;
endif ;
$calltime = date("Hi",mktime(date("H"),$thisminute2+$mincounter,0,date("m"),date("d"),date("Y"))) ;
$thisminute = $thisminute2 ;
$loopcounter = 1 ;
else :
$loopcounter = $loopcounter + 1 ;
endif ;
}
mysql_close($link);

 

 

The first one I was able to change by making

$TIME= $_SERVER["argv"][4]; 
$TIME= trim($TIME); 
$TIME= ltrim($TIME);

$calltime = $TIME

 

Which worked for the first file generated, but how would I change it for the other files generated?

 

 

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.