<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7694144353123907292</id><updated>2011-04-21T15:10:07.049-07:00</updated><title type='text'>visitor online</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://visitor-online.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7694144353123907292/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://visitor-online.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>RiaQ</name><uri>http://www.blogger.com/profile/02219056924149750665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7694144353123907292.post-154048350867294741</id><published>2009-01-28T09:41:00.001-08:00</published><updated>2009-01-28T09:41:49.987-08:00</updated><title type='text'></title><content type='html'>&lt;?php   &lt;br /&gt;$dataFile = "visitors.txt";   &lt;br /&gt;  &lt;br /&gt;$sessionTime = 30; //this is the time in **minutes** to consider someone online before removing them from our file   &lt;br /&gt;  &lt;br /&gt;//Please do not edit bellow this line   &lt;br /&gt;  &lt;br /&gt;error_reporting(E_ERROR | E_PARSE);   &lt;br /&gt;  &lt;br /&gt;if(!file_exists($dataFile)) {   &lt;br /&gt;    $fp = fopen($dataFile, "w+");   &lt;br /&gt;    fclose($fp);   &lt;br /&gt;}   &lt;br /&gt;  &lt;br /&gt;$ip = $_SERVER['REMOTE_ADDR'];   &lt;br /&gt;$users = array();   &lt;br /&gt;$onusers = array();   &lt;br /&gt;  &lt;br /&gt;//getting   &lt;br /&gt;$fp = fopen($dataFile, "r");   &lt;br /&gt;flock($fp, LOCK_SH);   &lt;br /&gt;while(!feof($fp)) {   &lt;br /&gt;    $users[] = rtrim(fgets($fp, 32));   &lt;br /&gt;}   &lt;br /&gt;flock($fp, LOCK_UN);   &lt;br /&gt;fclose($fp);   &lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;//cleaning   &lt;br /&gt;$x = 0;   &lt;br /&gt;$alreadyIn = FALSE;   &lt;br /&gt;foreach($users as $key =&gt; $data) {   &lt;br /&gt;    list( , $lastvisit) = explode("|", $data);   &lt;br /&gt;    if(time() - $lastvisit &gt;= $sessionTime * 60) {   &lt;br /&gt;        $users[$x] = "";   &lt;br /&gt;    } else {   &lt;br /&gt;        if(strpos($data, $ip) !== FALSE) {   &lt;br /&gt;            $alreadyIn = TRUE;   &lt;br /&gt;            $users[$x] = "$ip|" . time(); //updating   &lt;br /&gt;        }   &lt;br /&gt;    }   &lt;br /&gt;    $x++;   &lt;br /&gt;}   &lt;br /&gt;  &lt;br /&gt;if($alreadyIn == FALSE) {   &lt;br /&gt;    $users[] = "$ip|" . time();   &lt;br /&gt;}   &lt;br /&gt;  &lt;br /&gt;//writing   &lt;br /&gt;$fp = fopen($dataFile, "w+");   &lt;br /&gt;flock($fp, LOCK_EX);   &lt;br /&gt;$i = 0;   &lt;br /&gt;foreach($users as $single) {   &lt;br /&gt;    if($single != "") {   &lt;br /&gt;        fwrite($fp, $single . "\r\n");   &lt;br /&gt;        $i++;   &lt;br /&gt;    }   &lt;br /&gt;}   &lt;br /&gt;flock($fp, LOCK_UN);   &lt;br /&gt;fclose($fp);   &lt;br /&gt;  &lt;br /&gt;if($uo_keepquiet != TRUE) {   &lt;br /&gt;    echo '&lt;div style="padding:5px; margin:auto; background-color:#fff"&gt;&lt;b&gt;' . $i . ' visitors online&lt;/b&gt;&lt;/div&gt;';   &lt;br /&gt;}   &lt;br /&gt;  &lt;br /&gt;?&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7694144353123907292-154048350867294741?l=visitor-online.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visitor-online.blogspot.com/feeds/154048350867294741/comments/default' title='Poskan Komentar'/><link rel='replies' type='text/html' href='http://visitor-online.blogspot.com/2009/01/sessiontime-60-usersx-else-ifstrposdata.html#comment-form' title='0 Komentar'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7694144353123907292/posts/default/154048350867294741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7694144353123907292/posts/default/154048350867294741'/><link rel='alternate' type='text/html' href='http://visitor-online.blogspot.com/2009/01/sessiontime-60-usersx-else-ifstrposdata.html' title=''/><author><name>RiaQ</name><uri>http://www.blogger.com/profile/02219056924149750665</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
