function login() { if (Params::get("username") == Config::instance()->ADMIN_USERNAME && Params::get("password") == Config::instance()->ADMIN_PASSWORD) { Session::set("/session/type", "admin"); Session::set("/session/username", Params::get("username")); Session::set("/session/ip", Request::getRemoteIp()); Session::set("/session/timestamp_inizio_sessione", time()); return Redirect::success(); } else { return Redirect::failure(); } }
function testGetRemoteIp() { $ip = Request::getRemoteIp(); $ip_nums = explode(".", $ip); $this->assertTrue(count($ip_nums), 4, "Il numero di parti di cui e' composto l'ip non corrisponde!!"); foreach ($ip_nums as $num) { $this->assertTrue($num >= 0 && $num < 256, "Il numero non e' valido."); } }
$mm = intval(floor($durata_sessione / 60) % 60); $hh = intval(floor($durata_sessione / 3600)); ?> Connesso da : <b><?php echo $hh; ?> h <?php echo $mm; ?> min</b><br /> Utente connesso : <b><?php echo Session::get("/session/username"); ?> </b><br /> IP : <b><?php echo Request::getRemoteIp(); ?> </b><br /> <br /> Contatta<br /> MBCRAFT<br /> info@mbcraft.it<br /> 349 3510861<br /> <br /> <a href="mailto:info@INSERT-YOUR-MAIL-HERE.it?Subject=Richiesta assistenza per <?php echo Host::current(); ?> ">[Richiedi assistenza via mail]</a><br /> <a href="mailto:info@INSERT-YOUR-MAIL-HERE.it?Subject=Segnalazione bug per <?php echo Host::current(); ?>