Closed kzap closed 8 years ago
ah nvm i see there's a Connector()->disable() method
this works :)
// ?phpconsole=1 to activate and ?phpconsole=0 to deactivate
if (isset($_GET['phpconsole']) && $_GET['phpconsole']) {
$_SESSION['phpconsole'] = 1;
} elseif (isset($_GET['phpconsole']) && !$_GET['phpconsole'] && isset($_SESSION['phpconsole'])) {
unset($_SESSION['phpconsole']);
}
// register this so all \PC::debug calls still work
\PhpConsole\Helper::register();
if (\PhpConsole\Connector::getInstance()->isActiveClient()) {
$connector = \PhpConsole\Connector::getInstance();
$connector->setPassword('YOUR PASSWORD'); // protect access by password
$connector->enableSslOnlyMode(); // PHP Console clients will be always redirected to HTTPS
if (!(isset($_SESSION['phpconsole']) && $_SESSION['phpconsole'])) {
$connector->disable();
} else {
// Init errors & exceptions handler
$handler = \PC::getHandler();
$handler->start(); // start handling PHP errors & exceptions
}
}
\PC::debug('test');
Password protection is nice but its basically telling everyone with PHPConsole that all it takes is a password and that we have the library
it would be nice if we could only activate the debugging via our own conditions like a COOKIE or some Admin Login.
Right now if you dont set a password, it assumes no password. I'd like to keep my debug code but show it to only those with access and not tell the world that we use PHPConsole on our site