diff options
author | Malf Furious <m@lfurio.us> | 2017-06-27 01:49:35 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2017-06-27 01:49:35 -0400 |
commit | 479aca0db88f0b1af52f399f19a0a8267bd10744 (patch) | |
tree | 520e9eedf08edf18f4288f8eb78a51aec2cefb5c | |
parent | 09f403582c5de5dcc97b265e8ae42469c9c8ff3f (diff) | |
download | scrott-479aca0db88f0b1af52f399f19a0a8267bd10744.tar.gz scrott-479aca0db88f0b1af52f399f19a0a8267bd10744.zip |
Add dbconfig model code
Diffstat (limited to '')
-rw-r--r-- | app/model/dbconfig.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/app/model/dbconfig.php b/app/model/dbconfig.php new file mode 100644 index 0000000..822fd88 --- /dev/null +++ b/app/model/dbconfig.php @@ -0,0 +1,44 @@ +<?php + +/* + * SCROTT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * For more information, please refer to UNLICENSE + */ + +require_once "class/database.class.php"; +require_once "class/form.class.php"; + +/* + * Action: save - Write given configuration parameters to the database + * configuration file. + */ +if (isAction("save")) +{ + global $_SCROTT; + + $form = new form(); + $form->text("dbHost"); + $form->text("dbUname"); + $form->text("dbPasswd", false); + $form->text("dbName"); + + if (!$form->populate(input())) + return; + + $stat = database::setConfig("mysql", $form->dbHost, $form->dbUname, + $form->dbPasswd, $form->dbName); + + if (!$stat) + return; + + location("/"); +} + +?> |