Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Put paneluser.php in site/plugins
function panelUser() {
$cookie = cookie::get('auth');
if(!$cookie) return false;
$info = s::get($cookie);
if(!$info) return false;
$file = c::get('') . '/panel/accounts/' . a::get($info, 'username') . '.php';
// check for an existing user account file
if(!file_exists($file)) return false;
$content = f::read($file);
$content = str_replace('<?php if(!defined(\'KIRBY\')) exit ?>', '', $content);
$user = yaml($content);
return $user;
$user = panelUser();
if($user) {
// the user is logged in
echo 'hello ' . $user['username'];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment