mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-27 06:29:19 +08:00
enhance performance at homepage
This commit is contained in:
parent
acfc7c4478
commit
e3dccf23d6
@ -9,7 +9,22 @@ class HomeController extends BaseController
|
||||
|
||||
public function index()
|
||||
{
|
||||
echo \View::make('index')->with('user', (isset($_SESSION['email']) ? new User($_SESSION['email']) : null));
|
||||
if (isset($_COOKIE['email']) && isset($_COOKIE['token'])) {
|
||||
$user = new User($_COOKIE['email']);
|
||||
|
||||
if ($_COOKIE['token'] == $user->getToken() && $user->getPermission() != "-1") {
|
||||
$_SESSION['email'] = $_COOKIE['email'];
|
||||
$_SESSION['token'] = $_COOKIE['token'];
|
||||
} else {
|
||||
// delete cookies
|
||||
setcookie("email", "", time() - 3600, '/');
|
||||
setcookie("token", "", time() - 3600, '/');
|
||||
}
|
||||
}
|
||||
|
||||
$user = isset($_SESSION['email']) ? new User($_SESSION['email']) : null;
|
||||
|
||||
echo \View::make('index')->with('user', $user);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user