<?  // PHPmyGallery - backend core - create password file

/* File description:

This script displays a form where the user can enter an admin password.
This password is inserted into the database (no encryption)

### What this script does:
###
### Included from: adminmenu.index.php
### |
### | (Uses templates from adminmenu/sessionpwd_create)
### +- Set Password   (display Form, modify Admin Password, Save to DB, display Result)
###
*/

$saveit        = $_POST['saveit']; 
$form_AdminPWD = $_POST['form_AdminPWD'];

if ($saveit=='youshellpass' && $form_AdminPWD != '') {
    $pktpl_vars['form_AdminPWD'] = $form_AdminPWD;
    
    // Write password into database
    putData($form_AdminPWD,'mainsetup','adminpassword');
    
    // Hopefully we succeeded so display message about it
    // Success Box template + vars
    $pktpl_vars['text_headline']                  = $l['passwordfile_written'];
    $pktpl_vars['template_admin_successBoxLinks'] = pktpl('adminmenu/admin_successBoxPassword.html');
    $pktpl_vars['template_admin_successBox']      = pktpl('adminmenu/admin_successBox.html');
} // if

// Make templates
$pktpl_vars['template_admin_table'] = pktpl('adminmenu/sessionpwd_create/sessionpwdTable.html');

?>