RE: [PHP] flush not flushing?

2003-03-25 Thread Bryan Koschmann - GKT
Daniel-

I just tried this, didn't seem to make a difference.

Thanks for the reply!

Bryan

On Tue, 25 Mar 2003, daniel wrote:

|hi , i have had similar issues its worked by doing a ob_flush before flush
|then u want a sleep statement so maybe try
|
|ob_flush();
|flush();
|sleep(2);
|
|??
|
|>= Original Message From Bryan Koschmann - GKT <[EMAIL PROTECTED]> =
|>Hello,
|>
|>I'm including a script I use to automatically e-mail overdue customers. My
|>problem is I have to have it sleep to avoid upsetting the mailserver, but
|>when I do, it seems to pause and sleep the total time (number of users x
|>sleep(1)) then output the whole block. I'm testing it now by printing the
|>name and email to the screen.
|>
|>Instead of:
|>
|>Customer 1 - [EMAIL PROTECTED]
|>pause 1 sec
|>Customer 2 - [EMAIL PROTECTED]
|>pause 1 sec
|>Customer 3 - [EMAIL PROTECTED]
|>pause 1 sec
|>
|>I get
|>
|>big big big pause
|>Customer 1 - [EMAIL PROTECTED]
|>Customer 2 - [EMAIL PROTECTED]
|>Customer 3 - [EMAIL PROTECTED]
|>
|>
|>Here is the script. Any help would be great!
|>
|>Thanks,
|>
|>  Bryan
|>
|>
|>
|>
|>$myname = "My Company";
|>$myemail = "[EMAIL PROTECTED]";
|>
|>$now = strtotime("now");
|>$nowdate = date("l, F jS Y", $now);
|>$nowtime = date("H:i", $now);
|>$nowmonth = date("F", $now);
|>$nowyear = date("Y", $now);
|>
|>$duedate = strtotime("25 $nowmonth $nowyear");
|>$duedate = date("l, F jS Y", $duedate);
|>
|>$t = mktime(0,0,0,date('m')+1,1,date('Y'));
|>$expdate = date("l, F jS Y", $t);
|>
|>$expdatenum = date("w", $t);
|>
|>if ($expdatenum == "6") {
|>$rendate = date("l, F jS Y", strtotime("$expdate +2 days"));
|>} else {
|>$rendate = date("l, F jS Y", strtotime("$expdate +1 day"));
|>}
|>
|>
|>$query = htmlspecialchars("execute goToExpire");
|>
|>$fp = fsockopen ("111.222.333.444", 45678, $errno, $errstr, 30);
|>
|>// return_format can be either "delimited" or "xml"
|>$connect = "
|>
|>  
|>  Provider=SqlOleDb;
|>  Data Source=(local);
|>  Initial Catalog=MyCompany;
|>  Integrated Security=SSPI;
|>  
|>  
|>  delimited
|>  ~
|>  
|>  
|>  
|>  $query
|>  
|>
|>";
|>
|>$usercount = "0";
|>
|>if (!$fp) {
|>  echo "$errstr ($errno)\n";
|>} else {
|>  fputs ($fp, "$connect");
|>  flush();
|>
|>  // Create some headings for the table
|>
|>  while (!feof($fp)) {
|>  $buffer = fgets($fp, 4096);
|>  $row = explode('~', $buffer);
|>
|>  if (!empty($row[0])) {
|>  if ($row[0] == "ERROR") {
|>  echo "$row[0]: $row[1]
|$row[2]\n";
|>  } else {
|>  if (username($row[4]) !== "") {
|>
|>  $isbiz = str_replace("\r\n", "", $row[6]);
|>  $accountnum = account($row[0]);
|>  $amountdue = amount($row[5]);
|>
|>  if ($isbiz == "True") {
|>  $fullname = name($row[1]);
|>  } elseif ($isbiz == "False") {
|>  if (miname($row[3]) == "") {
|>  $fullname = name($row[2]) . " " . 
name($row[1]);
|>  } else {
|>  $fullname = name($row[2]) . " " . 
miname($row[3]) . " " . name($row[1]);
|>  }
|>  }
|>  flush();
|>  $subject = "Account Status: #" . account($row[0]);
|>  $message =  "\r\n" .
|>  "$fullname\r\n" .
|>  "Account #" . account($row[0]) . 
"\r\n\r\n" .
|>  "Payment Reminder!\r\n\r\n" .
|>  "Our records indicate that we have not 
received your payment of
|\$$amountdue due\r\n" .
|>  "on $duedate for your Internet access 
account. Please\r\n" .
|>  "send in your payment to prevent any 
interruption in your service.
|Any\r\n" .
|>  "accounts with an open balance will 
expire on $expdate\r\n" .
|>  "at 5:00pm, and cannot be reactivated 
until $rendate at
|9:00am.\r\n\r\n" .
|>  "If you have already sent in payment, 
please disregard this reminder.
|If\r\n" .
|>  "you believe your account to be 
up-to-date or believe this message to
|be in\r\n" .
|>  "error, feel free to call us at (555) 
123-4567 or 

RE: [PHP] flush not flushing?

2003-03-25 Thread daniel
hi , i have had similar issues its worked by doing a ob_flush before flush 
then u want a sleep statement so maybe try

ob_flush();
flush();
sleep(2);

??

>= Original Message From Bryan Koschmann - GKT <[EMAIL PROTECTED]> =
>Hello,
>
>I'm including a script I use to automatically e-mail overdue customers. My
>problem is I have to have it sleep to avoid upsetting the mailserver, but
>when I do, it seems to pause and sleep the total time (number of users x
>sleep(1)) then output the whole block. I'm testing it now by printing the
>name and email to the screen.
>
>Instead of:
>
>Customer 1 - [EMAIL PROTECTED]
>pause 1 sec
>Customer 2 - [EMAIL PROTECTED]
>pause 1 sec
>Customer 3 - [EMAIL PROTECTED]
>pause 1 sec
>
>I get
>
>big big big pause
>Customer 1 - [EMAIL PROTECTED]
>Customer 2 - [EMAIL PROTECTED]
>Customer 3 - [EMAIL PROTECTED]
>
>
>Here is the script. Any help would be great!
>
>Thanks,
>
>   Bryan
>
>
>
>
>$myname = "My Company";
>$myemail = "[EMAIL PROTECTED]";
>
>$now = strtotime("now");
>$nowdate = date("l, F jS Y", $now);
>$nowtime = date("H:i", $now);
>$nowmonth = date("F", $now);
>$nowyear = date("Y", $now);
>
>$duedate = strtotime("25 $nowmonth $nowyear");
>$duedate = date("l, F jS Y", $duedate);
>
>$t = mktime(0,0,0,date('m')+1,1,date('Y'));
>$expdate = date("l, F jS Y", $t);
>
>$expdatenum = date("w", $t);
>
>if ($expdatenum == "6") {
>$rendate = date("l, F jS Y", strtotime("$expdate +2 days"));
>} else {
>$rendate = date("l, F jS Y", strtotime("$expdate +1 day"));
>}
>
>
>$query = htmlspecialchars("execute goToExpire");
>
>$fp = fsockopen ("111.222.333.444", 45678, $errno, $errstr, 30);
>
>// return_format can be either "delimited" or "xml"
>$connect = "
>
>   
>   Provider=SqlOleDb;
>   Data Source=(local);
>   Initial Catalog=MyCompany;
>   Integrated Security=SSPI;
>   
>   
>   delimited
>   ~
>   
>   
>   
>   $query
>   
>
>";
>
>$usercount = "0";
>
>if (!$fp) {
>   echo "$errstr ($errno)\n";
>} else {
>   fputs ($fp, "$connect");
>   flush();
>
>   // Create some headings for the table
>
>   while (!feof($fp)) {
>   $buffer = fgets($fp, 4096);
>   $row = explode('~', $buffer);
>
>   if (!empty($row[0])) {
>   if ($row[0] == "ERROR") {
>   echo " color=#ff>$row[0]: $row[1] 
$row[2]\n";
>   } else {
>   if (username($row[4]) !== "") {
>
>   $isbiz = str_replace("\r\n", "", $row[6]);
>   $accountnum = account($row[0]);
>   $amountdue = amount($row[5]);
>
>   if ($isbiz == "True") {
>   $fullname = name($row[1]);
>   } elseif ($isbiz == "False") {
>   if (miname($row[3]) == "") {
>   $fullname = name($row[2]) . " " . 
> name($row[1]);
>   } else {
>   $fullname = name($row[2]) . " " . 
> miname($row[3]) . " " . name($row[1]);
>   }
>   }
>   flush();
>   $subject = "Account Status: #" . account($row[0]);
>   $message =  "\r\n" .
>   "$fullname\r\n" .
>   "Account #" . account($row[0]) . 
> "\r\n\r\n" .
>   "Payment Reminder!\r\n\r\n" .
>   "Our records indicate that we have not 
> received your payment of 
\$$amountdue due\r\n" .
>   "on $duedate for your Internet access 
> account. Please\r\n" .
>   "send in your payment to prevent any 
> interruption in your service. 
Any\r\n" .
>   "accounts with an open balance will 
> expire on $expdate\r\n" .
>   "at 5:00pm, and cannot be reactivated 
> until $rendate at 
9:00am.\r\n\r\n" .
>   "If you have already sent in payment, 
> please disregard this reminder. 
If\r\n" .
>   "you believe your account to be 
> up-to-date or believe this message to 
be in\r\n" .
>   "error, feel free to call us at (555) 
> 123-4567 or reply to this message 
to\r\n" .
>   "discuss your account.\r\n\r\n\r\n" .
>   "\tMy COmpany\r\n"