| 12345678910111213141516171819202122 |
- #!/usr/bin/env php
- <?php
- $_SERVER['SERVER_NAME'] = gethostname();
- $curDir = dirname(__FILE__);
- if (!preg_match('/(^.*)stuff.*$/', $curDir, $matches)) die('ScriptLocationError');;
- @require_once $matches[1] . 'se-lib' . DIRECTORY_SEPARATOR . 'bootstrap.php';
- date_default_timezone_set('Europe/Warsaw');
- try {
- Lib::loadClass('Token');
- $tokenObj = new Token(Config::getConfFile('default_db')['pass']);
- $token = $tokenObj->genToken();
- error_log($token);
- $hash = readline();
- if ($pass = $tokenObj->verify($hash)) echo "mysql -u" . Config::getConfFile('default_db')['user'] . " -p{$pass} -A -D " . Config::getConfFile('default_db')['database'];
- else {
- error_log("This attempt has been logged");
- }
- } catch (Exception $e) {
- error_log("Unknown error");
- }
- ?>
|