Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lock and unlock
<?php //php 7.0.8 // \app\controllers\ProfileController class ProfileController { // Action lock public function lock() { $user = $this->app->user; if (!$user->isLocked) { if ($user->setLocked(true)->save()) { return $this->app->render(array('template' => 'utils/lock.tpl'), array('status' => 'Для разблокировки введите код')); } } } // Action unlock public function unlock() { $user = $this->app->user; if ($user->isLocked) { if ($this->request->get('code')) { $this->app->telegram->send($user->getTelegramId(), $user->getUnlockCode()); return $this->app->render(array('template' => 'utils/lock.tpl'), array('status' => 'Код выслан в Telegram')); } $code = $this->request->post('code') ?? 0; if ($user->isValidUnlockCode($code)) { $user->setLocked(false)->save(); return $this->app->redirect->prevPage(); } return return $this->app->render(array('template' => 'utils/lock.tpl'), array('status' => 'Неверный код')); } } } ?>
run
|
edit
|
history
|
help
0
Add_adress
Haha
Access of protected class members through derived classes
B
S t o p !
Tugas 1
Orders
susuganan
123
Розклад