hiya guys,
I have a question, i want to display the image which is above the page, while my script loads in the background.
This is a simple script which check for new messages in my mailbox, so it is more like GMAIL's loading bar which is shown just before we land into our mailboxes.
Guys, how do i do it ? Because i have tried ob_start and ob_end_flush, but with no luck i am unable to see the image before script terminates. The whole data is shown into browser in one go. How do i slice it ..
The piece of code is like this ::
[PHP]
<?php
require_once("l ib/POP3.php");
include('lib/mimeDecode.php' );
require_once(". ./config/config.inc.php" );
echo '<img src="loader.gif " />';
function gmail($em){
$start=strrpos( $em,"<");
$end=strrpos($e m,">");
$len=$start+4;
$email=substr($ em,$len,$end-$len);
return $email;
}
/*************** *** Function to parse message and splits the needful into parts *************** ****/
function parse_output(&$ obj, &$parts){
if(!empty($obj->parts)){
for($i=0; $i<count($obj->parts); $i++)
parse_output($o bj->parts[$i], $parts);
}else{
$ctype = $obj->ctype_primary. '/'.$obj->ctype_secondar y;
switch($ctype){
case 'text/plain':
if(!empty($obj->disposition) AND $obj->disposition == 'attachment'){
$parts['attachments'][] = $obj->body;
}else{
$parts['text'][] = $obj->body;
}
break;
case 'text/html':
if(!empty($obj->disposition) AND $obj->disposition == 'attachment'){
$parts['attachments'][] = $obj->body;
}else{
$parts['html'][] = $obj->body;
}
break;
default:
$parts['attachments'][] = $obj->body;
$parts['attachments']['name']=$obj->ctype_paramete rs['name'];
}
}
}
/*************** Variable Initialization ************/
$user='realin@d omain.com';
$pass='realin';
$host='mail.dom ain.com';
$port="110";
$commid=(int)"6 ";
/*@ var total number of messages
in the inbox */
$nTotal="";
/* @var Messages which are
being retrieved */
$retr="";
$my=array();
$data=array();
$obj=&new Net_POP3();
$obj->connect("$host ","$port");
$ret=$obj->login($user , $pass,'USER' );
if(is_object($r et))
echo "Invalid Username/Password";
/********** Gets the office status of the mailbox, viz number of messages,size,U ID *************/
$listing=$obj->getListing() ;
foreach($listin g as $l){
$id=$l["msg_id"];
$head[$id]=$obj->getParsedHeade rs($id);
$body[$id]=$obj->getMsg($id);
}
?>
[/PHP]
I have a question, i want to display the image which is above the page, while my script loads in the background.
This is a simple script which check for new messages in my mailbox, so it is more like GMAIL's loading bar which is shown just before we land into our mailboxes.
Guys, how do i do it ? Because i have tried ob_start and ob_end_flush, but with no luck i am unable to see the image before script terminates. The whole data is shown into browser in one go. How do i slice it ..
The piece of code is like this ::
[PHP]
<?php
require_once("l ib/POP3.php");
include('lib/mimeDecode.php' );
require_once(". ./config/config.inc.php" );
echo '<img src="loader.gif " />';
function gmail($em){
$start=strrpos( $em,"<");
$end=strrpos($e m,">");
$len=$start+4;
$email=substr($ em,$len,$end-$len);
return $email;
}
/*************** *** Function to parse message and splits the needful into parts *************** ****/
function parse_output(&$ obj, &$parts){
if(!empty($obj->parts)){
for($i=0; $i<count($obj->parts); $i++)
parse_output($o bj->parts[$i], $parts);
}else{
$ctype = $obj->ctype_primary. '/'.$obj->ctype_secondar y;
switch($ctype){
case 'text/plain':
if(!empty($obj->disposition) AND $obj->disposition == 'attachment'){
$parts['attachments'][] = $obj->body;
}else{
$parts['text'][] = $obj->body;
}
break;
case 'text/html':
if(!empty($obj->disposition) AND $obj->disposition == 'attachment'){
$parts['attachments'][] = $obj->body;
}else{
$parts['html'][] = $obj->body;
}
break;
default:
$parts['attachments'][] = $obj->body;
$parts['attachments']['name']=$obj->ctype_paramete rs['name'];
}
}
}
/*************** Variable Initialization ************/
$user='realin@d omain.com';
$pass='realin';
$host='mail.dom ain.com';
$port="110";
$commid=(int)"6 ";
/*@ var total number of messages
in the inbox */
$nTotal="";
/* @var Messages which are
being retrieved */
$retr="";
$my=array();
$data=array();
$obj=&new Net_POP3();
$obj->connect("$host ","$port");
$ret=$obj->login($user , $pass,'USER' );
if(is_object($r et))
echo "Invalid Username/Password";
/********** Gets the office status of the mailbox, viz number of messages,size,U ID *************/
$listing=$obj->getListing() ;
foreach($listin g as $l){
$id=$l["msg_id"];
$head[$id]=$obj->getParsedHeade rs($id);
$body[$id]=$obj->getMsg($id);
}
?>
[/PHP]
Comment