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'); }
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'; saveconfig_ini($config['site']); }
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", 999999); $account->setCustomField("created", time()); } else { $number = $account->create(1, 1, 1); $account->setPassword($newpass_to_db); $account->unblock(); $account->save(); $account->setCustomField("page_access", 999999); $account->setCustomField("created", time()); } $_SESSION['account'] = 1; $_SESSION['password'] = $newpass; $logged = TRUE; 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']);
function add_points(OTS_Account $account, $number_of_points) { if ($account->isLoaded()) { $account->setCustomField('premium_points', $account->getCustomField('premium_points') + $number_of_points); return true; } else { return false; } }