andy's php projects
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Script and site usage:
All of the scripts on this site are provided free for non-commerical, personal or non-profit use. If you find these scripts useful to you, appreciate the free support, or are just an all round nice person, then why not donate a little dosh? If you wish to use any of these in a commercial system, please refer to the payment plan.


processing

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> WWW Checkup
View previous topic :: View next topic  
Author Message
safe
Newbie


Joined: 20 Dec 2003
Posts: 2

PostPosted: Sat Dec 20, 2003 10:53 am    Post subject: processing Reply with quote

Hi all,

is it possible to show processing while checking for updates?

thank you alot
Back to top
View user's profile Send private message
amnuts
Site Admin


Joined: 01 Sep 2002
Posts: 662
Location: East Sussex, England

PostPosted: Sat Dec 20, 2003 10:06 pm    Post subject: Reply with quote

Hi, and welcome to the board!

You could use the 'flush' function to show processing as it occurs. In the demo area I updated CheckAll function in the class to look like this:

PHP:
<?php

        
function CheckAll()
        {
                
$sql "SELECT id,website,hash,UNIX_TIMESTAMP(lastchecked) AS lastchecked,UNIX_TIMESTAMP(lastupdated) AS lastupdated FROM {$this->tbl}";
                
$result = @mysql_query($sql$this->id) or die("Unable to perform query: $sql");
                while (
$row = @mysql_fetch_array($resultMYSQL_ASSOC))
                {
                        
$site = array();
                        echo 
"Checking {$row['website']} :: ";
                        
flush();
                        
set_time_limit(120);
                        
$site = @file($row['website']);
                        if (empty(
$site))
                        {
                                echo 
"could not be fetched.<br>\n";
                                
flush();
                        }
                        else
                        {
                                
$hash md5(strip_tags(join(''$site)));
                                if (
$this->autoupdate)
                                {
                                        if (
$hash != $row['hash'])
                                        {
                                                
$this->results[] = $row;
                                                
$sql "UPDATE {$this->tbl} SET lastchecked=NOW(),lastupdated=NOW(),hash='{$hash}' WHERE id={$row['id']}";
                                        }
                                        else
                                        {
                                                
$sql "UPDATE {$this->tbl} SET lastchecked=NOW() WHERE id={$row['id']}";
                                        }
                                        @
mysql_query($sql$this->id) or die("Unable to perform query: $sql");
                                }
                                else
                                {
                                        if (
$hash != $row['hash'])
                                        {
                                                
$this->results[] = $row;
                                        }
                                }
                                echo 
"processed<br>\n";
                                
flush();
                        }
                }
                @
mysql_free_result($result);
        }

?>


Hope that helps you out.

Andy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
safe
Newbie


Joined: 20 Dec 2003
Posts: 2

PostPosted: Sun Dec 21, 2003 8:24 am    Post subject: it works Reply with quote

Thank you sir, it worked as I wanted it to work.

wish you love
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    php.amnuts.com Forum Index -> WWW Checkup All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group