I want to add Adminer to ISPConfig, but not the way the [existing plugin](https://github.com/natanfelles/adminer-ispconfig has done it.
It uses the ISPConfig remote API where I simply want to check if browser is already logged in on ISPConfig (to decide whether to display Adminer or deny) and don't want to auto-fill/connect to SQL database.
The adminer.php file would be served from the same host, port and path as ISPConfig (http://ispconfig.example.com:8080/adminer.php)
The way to check for ISPConfig auth is via theses 3 lines of code:
require_once'/usr/local/ispconfig/interface/lib/config.inc.php';require_once'/usr/local/ispconfig/interface/lib/app.inc.php';$app->auth->check_module_permissions('client');// checks and redirect+exit if not granted
So I added thoses at the beginning of adminer.php and it works: accessing http://ispconfig.example.com:8080/adminer.php without being already logged to ISPConfig redirects to ISPConfig's login form.
If already logged, accessing the same page shows the Adminer SQL connection form.
For a simple PHP script without sessions (say a simple phpinfo(); helpful page) it would over.
But Adminer uses sessions and so does ISPConfig: it's not that simple.
When submitting the Adminer connection form I see some HTTP requests being redirected to /index.php (done by ISPConfig), indicating a loss of session somewhere in the process...
Hello,
I want to add Adminer to ISPConfig, but not the way the [existing plugin](https://github.com/natanfelles/adminer-ispconfig has done it.
It uses the ISPConfig remote API where I simply want to check if browser is already logged in on ISPConfig (to decide whether to display Adminer or deny) and don't want to auto-fill/connect to SQL database.
The adminer.php file would be served from the same host, port and path as ISPConfig (http://ispconfig.example.com:8080/adminer.php)
The way to check for ISPConfig auth is via theses 3 lines of code:
So I added thoses at the beginning of
adminer.php
and it works: accessing http://ispconfig.example.com:8080/adminer.php without being already logged to ISPConfig redirects to ISPConfig's login form.If already logged, accessing the same page shows the Adminer SQL connection form.
For a simple PHP script without sessions (say a simple
phpinfo();
helpful page) it would over.But Adminer uses sessions and so does ISPConfig: it's not that simple.
When submitting the Adminer connection form I see some HTTP requests being redirected to
/index.php
(done by ISPConfig), indicating a loss of session somewhere in the process...I tried to swap the sessions (use ISPConfig's to do the auth check and go back to Adminer's), using naive code from https://stackoverflow.com/questions/609756/can-you-switch-php-sessions-in-a-session:
Without luck: Adminer now says the Session expired once I submit the connection form...
Before doing more digging, Is my goal (swap sessions) unreachable?
Can
sid()
,restart_session()
andstop_session()
be of any help?I saw multiple integrations but they mostly all use
credentials()
to auto-connect.Thanks
Last edit: CDuv 2021-08-11
I like your artıcle