<li><a href="index.php?module=muser&task=user_list">Users list <span class="glyphicon glyphicon-user"></span></a></li> <li><a href="index.php?module=muser&task=user_add">Add new user <span class="glyphicon glyphicon-plus"></span></a></li> <li class="divider"></li> <li><a href="index.php?module=preferences">Preferences <span class="glyphicon glyphicon-cog"></span></a></li> <li class="divider"></li> <?php } ?> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"><?php MPut::_html(MAuth::user()); ?> <span class="caret"></span></a> <ul class="dropdown-menu"> <li> <a href="index.php?module=profile"> Profile <span class="glyphicon glyphicon-user"></span> </a> </li> <li> <a href="javascript:void(0)" onclick="$( '#logout-form' ).submit();"> <form action="index.php?module=login" method="post" id="logout-form"> <input type="hidden" name="do-logout" value="1" /> Logout <span class="glyphicon glyphicon-off"></span> </form> </a>
private static function check_auth() { if (!sizeof($_COOKIE) > 0) { return null; } if (!isset($_COOKIE['mpmi_r'])) { return null; } if (!isset($_COOKIE['mpmi_t'])) { return null; } if (!isset($_COOKIE['mpmi_b'])) { return null; } $cookie_of_rand = MCrypt::decrypt($_COOKIE['mpmi_r']); $cookie_of_time = MCrypt::decrypt($_COOKIE['mpmi_t']); $cookie_of_browser = MCrypt::decrypt($_COOKIE['mpmi_b']); $rand_array = explode(' ', $cookie_of_rand); $user = new M_User($rand_array[0], true); if ($user) { if ($user->compare_lastlogin($cookie_of_rand, $cookie_of_time, $cookie_of_browser)) { self::$auth = true; self::$user = $user->get_username(); self::$user_id = $user->get_id(); self::$group_id = $user->get_group_id(); } } }