static function logVisitor($id, $type) { // echo $id." : ".$type; $today = date("Y-m-d"); $time = date("H:i:s"); $entry = VisitorLog::where('date', '=', $today)->where('type', '=', $type)->where('entityid', '=', $id)->first(); if (is_null($entry)) { $visitor = new VisitorLog(); $visitor->date = $today; $visitor->type = $type; $visitor->entityid = $id; $visitor->count = 1; $visitor->lastaccess = $time; $visitor->save(); // echo " adding new "; } else { $entry->count += 1; $entry->lastaccess = $time; $entry->save(); // echo " updated "; } /* $str = explode('/',$_SERVER['PHP_SELF']); unset($str[0]); unset($str[1]); $url = ""; if(count($str)==0) $url = "//"; else foreach($str as $part) $url.=$part.'/'; $url = substr($url,0,strlen($url)-1); echo " url now is ".$url; echo 'the use ris '.$_SERVER['PHP_SELF'];*/ }
$output = substr($output, 0, strlen($output) - 1); echo HTML::linkImage('home', HTML::image('img/smile.jpg')); ?> <div class="shadowed"> <div class="inner-boundary"> <div class="inner-border" style="padding: 10px;"> <p id="message">Total pageviews [daywise]</p> <div id="chart1" align="center" style="margin:0 auto;width:600px;align:center "></div> <div id="highli" style=" position: absolute;"></div> <table style="margin: 0 auto"> <tbody> <tr><td style="width: 500px"><b>Name</td><td><b>Total visits</b></td></tr> <?php $entries = VisitorLog::where('date', '=', $passed[0])->order_by('count', 'desc')->get(); foreach ($entries as $entry) { echo '<tr >'; $id = $entry->entityid; $type = $entry->type; if ($type == 'A') { $article = Article::find($id); if (!is_null($article)) { echo '<td><a target="_blank" target="_blank" href="' . $article->getArticleUrl() . '">' . $article->title . '</a></td>'; } else { continue; } } elseif ($type == 'C') { $category = Category::find($id); if (!is_null($category)) { echo '<td><a target="_blank" href="' . $category->getCategoryUrl() . '">' . $category->cname . '</a></td>';