Example #1
0
 function _account_exists($name)
 {
     $ots = POT::getInstance();
     $ots->connect(POT::DB_MYSQL, connection());
     $account = new OTS_Account();
     $account->find($name);
     if ($account->isLoaded()) {
         $this->form_validation->set_message('_account_exists', 'Account with this name already exists.');
         return false;
     } else {
         return true;
     }
 }
Example #2
0
 if ($step == '5') {
     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>';
Example #3
0
                $mysqlhost = $server_config['sqlHost'];
                $mysqluser = $server_config['sqlUser'];
                $mysqlpass = $server_config['sqlPass'];
                $mysqldatabase = $server_config['sqlDatabase'];
                $sqlitefile = $server_config['sqliteDatabase'];
            }
            // loads #####POT mainfile#####
            include '../pot/OTS.php';
            // PDO and POT connects to database
            $ots = POT::getInstance();
            if ($server_config['sqlType'] == "mysql") {
                $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase));
            } elseif ($server_config['sqlType'] == "sqlite") {
                $ots->connect(POT::DB_SQLITE, array('database' => $config['site_ini']['server_path'] . $sqlitefile));
            }
            $email_db = new OTS_Account();
            $email_db->findByEMail($email);
            if ($email_db->isLoaded()) {
                echo '<font color="red">Account with this e-mail already exist.</font>';
            } else {
                echo '<font color="green">Good e-mail.</font>';
            }
        } else {
            echo '<font color="green">Good e-mail.</font>';
        }
    } else {
        echo '<font color="red">Wrong e-mail format.</font>';
    }
} else {
    echo '<font color="red">E-mail is too long (max. 255 chars).</font>';
}
Example #4
0
        echo '<image src="../images/false.gif"> <font color="red">Invalid account name format. Use only A-Z and numbers 0-9.</font>';
        exit;
    }
    //connect to DB
    $server_config = parse_ini_file($config_ini['server_path'] . 'config.lua');
    if (isset($server_config['sqlHost'])) {
        $mysqlhost = $server_config['sqlHost'];
        $mysqluser = $server_config['sqlUser'];
        $mysqlpass = $server_config['sqlPass'];
        $mysqldatabase = $server_config['sqlDatabase'];
        $sqlitefile = $server_config['sqliteDatabase'];
    }
    // loads #####POT mainfile#####
    include '../libs/pot/OTS.php';
    // PDO and POT connects to database
    $ots = POT::getInstance();
    if ($server_config['sqlType'] == "mysql") {
        $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase));
    } elseif ($server_config['sqlType'] == "sqlite") {
        $ots->connect(POT::DB_SQLITE, array('database' => $config_ini['server_path'] . $sqlitefile));
    }
    $account_db = new OTS_Account();
    $account_db->load($account);
    if ($account_db->isLoaded()) {
        echo '<image src="../images/false.gif"> <font color="red">Account with this name already exist.</font>';
    } else {
        echo '<image src="../images/true.gif"> <font color="green">Your account name will be:  ' . $account . '</font>';
    }
} else {
    echo '<image src="../images/false.gif"> <font color="red">Account name is too long (max. 30 chars).</font>';
}
Example #5
0
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;
    }
}