ghurty Posted January 24, 2010 Share Posted January 24, 2010 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); Link to comment https://forums.phpfreaks.com/topic/189596-how-to-modify-script-so-i-it-will-except-a-time-variable-instead-of-current-tim/ Share on other sites More sharing options...
JAY6390 Posted January 24, 2010 Share Posted January 24, 2010 $calltime = date("Hi",mktime(date("H"),$thisminute+2,0,date("m"),date("d"),date("Y"))) ; This can be modified to have a date passed to it See http://www.php.net/date for more info Link to comment https://forums.phpfreaks.com/topic/189596-how-to-modify-script-so-i-it-will-except-a-time-variable-instead-of-current-tim/#findComment-1000750 Share on other sites More sharing options...
ghurty Posted January 24, 2010 Author Share Posted January 24, 2010 I tried that, and I it allowed that the first file it generated was based on the time I passed. But every other file it created was based on current time. Thanks Link to comment https://forums.phpfreaks.com/topic/189596-how-to-modify-script-so-i-it-will-except-a-time-variable-instead-of-current-tim/#findComment-1000776 Share on other sites More sharing options...
ghurty Posted January 25, 2010 Author Share Posted January 25, 2010 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 Link to comment https://forums.phpfreaks.com/topic/189596-how-to-modify-script-so-i-it-will-except-a-time-variable-instead-of-current-tim/#findComment-1001080 Share on other sites More sharing options...
ghurty Posted January 25, 2010 Author Share Posted January 25, 2010 The problem starts when it moves over to the next time frame. Link to comment https://forums.phpfreaks.com/topic/189596-how-to-modify-script-so-i-it-will-except-a-time-variable-instead-of-current-tim/#findComment-1001086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.