Ejemplo n.º 1
0
         echo 'New password: <form action="install.php" method=POST><input type="text" name="newpass" size="35">(Don\'t give it password to anyone!)';
         echo '<input type="hidden" name="saveaccpassword" value="yes"><input type="hidden" name="page" value="step"><input type="hidden" name="step" value="5"><input type="submit" value="SET"></form><br>If account with number 1 doesn\'t exist installator will create it and set your password.';
     } else {
         $newpass = $_POST['newpass'];
         if (!check_password($newpass)) {
             echo 'Password contains illegal characters. Please use only a-Z and 0-9. <a href="install.php?page=step&step=5&server_conf=yes">GO BACK</a> and write other password.';
         } else {
             $newpass_to_db = password_ency($newpass);
             $account = new OTS_Account();
             $account->load(1);
             if ($account->isLoaded()) {
                 $account->setPassword($newpass_to_db);
                 $account->save();
                 $account->setCustomField("page_access", 6);
             } else {
                 $number = $account->create(1, 1, 1);
                 $account->setPassword($newpass_to_db);
                 $account->unblock();
                 $account->save();
                 $account->setCustomField("page_access", 6);
             }
             $_SESSION['account'] = 1;
             $_SESSION['password'] = $newpass;
             $logged = TRUE;
             $account->setCustomField("page_lastday", time());
             echo '<h1>Admin account number: 1<br>Admin account password: '******'newpass'] . '</h1><br/><h3>It\'s end of first part of installation. Installation is blocked. From now don\'t modify file config.ini!<br>Press links to STEPs 6 and 7 in menu.</h3>';
             $config['site']['install'] = 'no';
             saveconfig_ini($config['site']);
         }
     }
 }