Exemple #1
0
 function create()
 {
     $ide = new IDE();
     if ($ide->isLogged()) {
         $ide->redirect('../account');
     }
     $this->load->helper('form');
     if ($_POST) {
         $this->load->library('form_validation');
         $this->form_validation->set_rules('name', 'Account Name', 'required|min_length[4]|max_length[32]|callback__account_exists|alpha');
         $this->form_validation->set_rules('password', 'Password', 'required|matches[repeat]|min_length[4]|max_length[255]');
         $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
         if ($this->form_validation->run() == TRUE) {
             require APPPATH . 'config/ide_default.php';
             $ots = POT::getInstance();
             $ots->connect(POT::DB_MYSQL, connection());
             $account = new OTS_Account();
             $name = $account->createNamed($_POST['name']);
             $account->setPassword($_POST['password']);
             $account->setEmail($_POST['email']);
             $account->setCustomField('premdays', PREMDAYS);
             try {
                 $account->save();
                 $_SESSION['logged'] = 1;
                 $_SESSION['name'] = $_POST['name'];
                 $ide->redirect('../account');
             } catch (Exception $e) {
                 error($e->getMessage());
             }
         }
     }
     #Load view of creating account
     $this->load->view('create');
 }
Exemple #2
0
 echo '<h1>STEP ' . $step . '</h1>Set Admin Account<br>';
 $config['server'] = parse_ini_file($config['site']['server_path'] . 'config.lua');
 if (empty($_REQUEST['saveaccpassword'])) {
     echo 'Admin account number is: <b>1</b><br/>Set new password to this account.<br>';
     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';
Exemple #3
0
<?php

// to not repeat all that stuff
include 'quickstart.php';
// creates new account objects
$account = new OTS_Account(111111);
// this is your password
$password = '******';
// so if you use for example SHA1 hashing simply before any operation do
$password = sha1($password);
// saves password hash into database
$account->setPassword($password);
$account->save();