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);

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.