Ditto. There's really no reason it can't go here. - Craige On 2/5/07, benifactor <snorris17@xxxxxxx> wrote:
I agree. > hey. > > for my $0.02 worth.. these kinds of questions are not exactly only php. > however, i still see them as being valuable, and belonging to the php > list, > as they get into areas the php developers of sites might grapple with. i'm > of the opinion more, rather than less. > > so if you have more intelligent discussions regarding php/site development > technologies that integrate with php, this is the place for it!! > > peace.. > > > -----Original Message----- > From: Stut [mailto:stuttle@xxxxxxxxx] > Sent: Monday, February 05, 2007 5:31 AM > To: benifactor > Cc: php-general@xxxxxxxxxxxxx > Subject: Re: who is online? > > > benifactor wrote: >> sorry if you misunderstood, i just wanted to know if it could be done >> with php alone. > > It can't, and this should be fairly obvious. If the client-side makes no > contact with the server for a period of time, how do you expect it to > know that the user hasn't moved to another page? > > The bottom line is that this needs some client-side code to work, > whether it be Javascript or just an iframe with a meta refresh tag. > > -Stut > >> ----- Original Message ----- From: "Stut" <stuttle@xxxxxxxxx> >> To: "benifactor" <snorris17@xxxxxxx> >> Cc: <php-general@xxxxxxxxxxxxx> >> Sent: Monday, February 05, 2007 5:18 AM >> Subject: Re: who is online? >> >> >>> benifactor wrote: >>>> i have built a function to tell me how many users are on my site at >>>> any given time... <? >>>> >>>> //define function >>>> >>>> function bc_who ($who, $location) { >>>> >>>> >>>> //first we erase any expired entries //entries will expire after 5 >>>> mins $whoTime = time(); $whoTime = $whoTime - 300; >>>> mysql_query("Delete FROM bc_who where expire < $whoTime") or >>>> die(mysql_error()); >>>> >>>> //here we difine the variables needed to preform the check $whoExpire >>>> = time(); $whoIp = "$_SERVER[REMOTE_ADDR]"; >>>> >>>> //this will be changed as soon as user registration is finished >>>> $whoUser= "Guest"; //do the actual mysql queries >>>> >>>> mysql_query("Delete FROM bc_who where '$whoIp' = ip"); >>>> mysql_query("Insert INTO bc_who (id, user, ip, location, expire, >>>> status) VALUES (NULL, '$whoUser', '$whoIp', '$location', >>>> '$whoExpire', '$whoStatus')"); >>>> >>>> >>>> } >>>> >>>> //end who is function >>>> >>>> ?> >>>> >>>> this fuction works fine, however, i want to know if what i am about >>>> to ask is possible. >>>> >>>> the problem i have is, this function assumes that after five minutes >>>> if the user has not refreshed the page, or gone onto another page the >>>> user must be gone. in reality, i have pages users might be on for an >>>> hour or so without refreshing. i want my whos online to as acurate as >>>> possible so is there a way to do this on the fly? like, forgetting >>>> about the expire time and using a server side peice of code to >>>> communicate to the database, when there is no more communication the >>>> entry is deleted? please tell me there is a way, thank you in >>>> advance. >>> >>> Assuming you actually mean "client side" not "server side" (because >>> server-side is what you already have), you could do this in a number >>> of ways with Javascript. You could periodically call the server using >>> XmlHttpRequest, or you could keep it simple and reload an image which >>> points at a PHP script. Either way this is not a question for a PHP >>> list because it relates to client-side code. Google will almost >>> certainly have several useful sites. >>> >>> -Stut >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php