Esempio n. 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');
 }
Esempio n. 2
0
 /**
  * @version 0.0.5
  * @param OTS_Account $account Account to be deleted.
  * @deprecated 0.0.5 Use OTS_Account->delete().
  */
 public function deleteAccount(OTS_Account $account)
 {
     $this->db->query('DELETE FROM ' . $this->db->tableName('account') . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $account->getId());
 }
Esempio n. 3
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;
Esempio n. 4
0
 /**
  * Assigns character to account.
  * 
  * <p>
  * This method only updates object state. To save changes in database you need to use {@link OTS_Player::save() save() method} to flush changed to database.
  * </p>
  * 
  * @param OTS_Account $account Owning account.
  * @throws E_OTS_NotLoaded If passed <var>$account</var> parameter is not loaded.
  */
 public function setAccount(OTS_Account $account)
 {
     $this->data['account_id'] = $account->getId();
 }
Esempio n. 5
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>';
}
Esempio n. 6
0
<?php

// to not repeat all that stuff
include 'quickstart.php';
// creates new account object
$account = new OTS_Account();
// generates new account
$name = $account->createNamed();
// give user his name
echo 'Your account name is: ', $name;
Esempio n. 7
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 '../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));
            }
            $email_db = new OTS_Account();
            $email_db->find($email);
            if ($email_db->isLoaded()) {
                echo '<image src="../images/false.gif"> <font color="red">Account with this e-mail already exist.</font>';
            } else {
                echo '<image src="../images/true.gif"> <font color="green">Good e-mail.</font>';
            }
        } else {
            echo '<image src="../images/true.gif"> <font color="green">Good e-mail.</font>';
        }
    } else {
        echo '<image src="../images/false.gif"> <font color="red">Wrong e-mail format.</font>';
    }
} else {
    echo '<image src="../images/false.gif"> <font color="red">E-mail is too long (max. 255 chars).</font>';
}
Esempio n. 8
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>';
}
Esempio n. 9
0
 } elseif (!$config['site']['create_account_verify_mail']) {
     if (!check_password($reg_password)) {
         $reg_form_errors[] = "Password contains illegal chars (a-z, A-Z and 0-9 only!) or lenght.";
     }
 }
 //SECOND check
 ## check e-mail address in database
 if (empty($reg_form_errors)) {
     if ($config['site']['one_email']) {
         $test_email_account = $ots->createObject('Account');
         $test_email_account->findByEmail($reg_email);
         if ($test_email_account->isLoaded()) {
             $reg_form_errors[] = "Account with this e-mail address already exist in database.";
         }
     }
     $account_db = new OTS_Account();
     $account_db->find($reg_name);
     if ($account_db->isLoaded()) {
         $reg_form_errors[] = 'Account with this name already exist.';
     }
     if ($config['site']['referrer']) {
         $ref_check = $SQL->query('SELECT id FROM accounts WHERE id = ' . $reg_referrer . ' LIMIT 1')->fetch();
         if ($reg_referrer > 0 && $ref_check['id'] < 1) {
             $reg_form_errors[] = 'Uzywany przez Ciebie numer gracza, ktory polecil Ci nasz serwer nie istnieje. Popros go o poprawny link lub ponow rejestracje, aby kontynowac rejestracje bez polecajacego.';
         }
     }
 }
 // ----------creates account-------------(save in database)
 if (empty($reg_form_errors)) {
     //create object 'account' and generate new acc. number
     if ($config['site']['create_account_verify_mail']) {
Esempio n. 10
0
        $mysqluser = $server_config['mysqlUser'];
        $mysqlpass = $server_config['mysqlPass'];
        $mysqldatabase = $server_config['mysqlDatabase'];
        $sqlitefile = $server_config['sqliteDatabase'];
    } elseif (isset($server_config['sqlHost'])) {
        //old (0.2.4) ots config.lua file
        $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_ini['server_path'] . $sqlitefile));
    }
    $account_db = new OTS_Account();
    $account_db->find($account);
    if ($account_db->isLoaded()) {
        echo '<font color="red">Account with this name already exist.</font>';
    } else {
        echo '<font color="green">Good account name ( ' . $account . ' ). You can create account.</font>';
    }
} else {
    echo '<font color="red">Account name is too long (max. 32 chars).</font>';
}
Esempio n. 11
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();
Esempio n. 12
0
        }
    }
}
echo "</table>";
if (!$ide->isLogged()) {
    alert("You need to be logged in to access any options.");
} else {
    require_once 'system/application/libraries/POT/InvitesDriver.php';
    new InvitesDriver($guild);
    $invited_list = $guild->listInvites();
    if (count($invited_list) == 0) {
        echo "<center><b>This guild did not invite anyone.</b></center>";
    } else {
        $ots = POT::getInstance();
        $ots->connect(POT::DB_MYSQL, connection());
        $account_logged = new OTS_Account();
        $account_logged->load($_SESSION['account_id']);
        $account_players = $account_logged->getPlayers();
        echo "<table width='100%'>";
        echo "<tr><td><center><b>Name</b></center></td><td><center><b>Join</b></center></td></tr>";
        $characters = array();
        foreach ($account_players as $player_from_acc) {
            $characters[] = $player_from_acc->getName();
        }
        foreach ($invited_list as $invited_player) {
            if (in_array($invited_player->getName(), $characters)) {
                echo "<tr><td><center><a href='" . WEBSITE . "/index.php/character/view/" . $invited_player->getName() . "'>" . $invited_player->getName() . "</a></center></td><td><center><a href='" . WEBSITE . "/index.php/guilds/join/" . $guild->getId() . "/" . $invited_player->getId() . "'>Join</a></center></td></tr>";
            } else {
                echo "<tr><td><center><a href='" . WEBSITE . "/index.php/character/view/" . $invited_player->getName() . "'>" . $invited_player->getName() . "</a></center></td><td><center>Cannot join</center></td></tr>";
            }
        }
Esempio n. 13
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;
    }
}
Esempio n. 14
0
<?php

// to not repeat all that stuff
include 'quickstart.php';
// creates new account object
$account = new OTS_Account();
// loads account with ID (account number) 111111
$account->load(111111);
// alternative way - shorter
$account2 = new OTS_Account(111111);
// WARNING! This one won't work!
//$account2 = new OTS_Account('111111');
// '111111' is a string! not integer
// shows results of loading account
echo '111111 e-mail address: ', $account->getEMail();