mirror of
https://github.com/Ekokumppanit/Lentolaskuri.git
synced 2026-03-11 14:57:23 +00:00
Implemented database refresh key: import.php?key=[user specified refresh_key] (Closes #1)
This commit is contained in:
@@ -17,7 +17,8 @@ $config = array(
|
|||||||
'user' => 'username',
|
'user' => 'username',
|
||||||
'password' => 'password',
|
'password' => 'password',
|
||||||
'table' => 'airports',
|
'table' => 'airports',
|
||||||
'create_table' => true
|
'create_table' => true,
|
||||||
|
'refresh_key' => 'lentolaskuridatabasekey' // You should change this to your reset key
|
||||||
);
|
);
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
|
|||||||
@@ -18,6 +18,18 @@ if (is_readable('config.php')) {
|
|||||||
die("Couldn't find configuration file. Please check the installation guide.");
|
die("Couldn't find configuration file. Please check the installation guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if import.php?key= value matches $config['refresh_key']
|
||||||
|
* If matches continue, else stop processing with error message.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$key = (empty($_GET['key'])) ? null : $_GET['key'];
|
||||||
|
if ($config['refresh_key'] !== $key || empty($key)) {
|
||||||
|
$mysqli->close();
|
||||||
|
die("Wrong refresh_key, please check configuration file for the corrent key.");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If we can see lentolaskuri.sql and config.php setting
|
* If we can see lentolaskuri.sql and config.php setting
|
||||||
* $config['create_table'] is true, we try to create table for airports.
|
* $config['create_table'] is true, we try to create table for airports.
|
||||||
|
|||||||
Reference in New Issue
Block a user