$u = $_GET['u']; if ($u) { if (!$fm->isFriend($uId, $u)) //trying to view someone elses profile { header("Location: day.php"); } else { $uId = $u; } } $numSessions = 10; $manager = new DcWebManager(); $sessions = $manager->getLastSessions($uId, $numSessions); $user = $manager->loadUser($uId); $smarty = smartyInit(); $convertedSessions = array(); $distUnit = "km"; $timeUnit = "h"; $velUnit = $distUnit . "/" . $timeUnit; foreach ($sessions as $sess) { $s = DcUnitConverter::convertSession($sess, $distUnit, $timeUnit); array_push($convertedSessions, $s); } $sessions = $convertedSessions; //get max dist