Ejemplo n.º 1
0
 public function dbAddArtefact($artefact_id)
 {
     $dbh = new DBL();
     $strSQL = "INSERT INTO player_artefact (player_id, artefact_id, player_artefact_date) VALUES (" . $this->getId() . ", " . $artefact_id . ", " . time() . ")";
     $dbh->query($strSQL);
     return true;
 }
Ejemplo n.º 2
0
 public static function dbGet($id = NULL)
 {
     $dbh = new DBL();
     $strSQL = "SELECT * FROM alliance WHERE alliance.alliance_id=" . $id;
     $result = $dbh->query($strSQL);
     while ($record = $result->fetch_array()) {
         $newAlliance = new Alliance();
         $newAlliance->setName($record["alliance_name"]);
         $newAlliance->setCode($record["alliance_code"]);
         $newAlliance->setDescription($record["alliance_description"]);
         $buffer[] = $newAlliance;
     }
     $result->free();
     if (isset($id)) {
         return $buffer[0];
     }
     return $buffer;
 }
Ejemplo n.º 3
0
 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
     sendBack('That email is not valid');
 }
 ## test connection is to the Db works ##
 define("DBL_HOSTNAME", $db_host);
 // hostname of where the server is located
 define("DBL_USERNAME", $db_user);
 // username that can connect to that DB
 define("DBL_PASSWORD", $db_pass);
 // Password for that user
 define("DBL_DB", $db_name);
 // name of the database to connect to
 define("DB_CON_ERROR_SHOW", TRUE);
 // start connectionn to the DB
 require '../classes/dbl-class.php';
 $dbl = DBL::getInstance(true);
 // test connection if it fails then it dies (install test is true)
 if ($dbl->install_error != NULL) {
     sendBack($dbl->install_error);
 }
 ## Read Config ##
 $file_read = 'config.txt';
 $file_write = 'config.php';
 if (file_exists($file_read)) {
     chmod($file_read, 0777);
     if (is_readable($file_read)) {
         $fr = fopen($file_read, 'r');
         while (!feof($fr)) {
             ## get the line
             $config = fgets($fr, 512);
             ## replace anything that needs to be replaced
Ejemplo n.º 4
0
<?php

require_once "lib/Player.class.php";
$dblink = new DBL();
$strSQL = "SELECT player.*, race.race_name FROM player, race\n\t\t\tWHERE player.race_id = race.race_id\n\t\t\tAND player_name='" . $_POST["logon"]["name"] . "'\n\t\t\tAND player_password='******'";
$result = $dblink->query($strSQL);
if ($player = $result->fetch_array()) {
    $player = new Player($player["player_id"], $player["player_name"], $player["alliance_id"], $player["race_name"]);
    session_start();
    if (isset($_SESSION["player"])) {
        unset($_SESSION["player"]);
    }
    $_SESSION["player"] = serialize($player);
    header("Location: home.php");
} else {
    header("Location: index.html");
}
Ejemplo n.º 5
0
// do not edit
error_reporting(E_ALL ^ E_NOTICE);
// show all errors but notices
require 'inc/ctracker.php';
// anti worm injection protection
require 'inc/config.php';
// load the config file
if (INSTALLED != 'yes') {
    // if echelon is not install (a constant is added to the end of the config during install) then die and tell the user to go install Echelon
    die('You still need to install Echelon. <a href="install/index.php">Install</a>');
}
require_once 'inc/functions.php';
// require all the basic functions used in this site
require 'classes/dbl-class.php';
// class to preform all DB related actions
$dbl = DBL::getInstance();
// start connection to the local Echelon DB
require 'inc/setup.php';
// class to preform all DB related actions
## If SSL required die if not an ssl connection ##
if ($https_enabled == 1) {
    if (!detectSSL() && !isError()) {
        // if this is not an SSL secured page and this is not the error page
        sendError('ssl');
        exit;
    }
}
require 'classes/session-class.php';
// class to deal with the management of sesssions
require 'classes/members-class.php';
// class to preform all B3 DB related actions
Ejemplo n.º 6
0
 public function editSettings($tables, $names)
 {
     global $game;
     // current game id
     $dbl = DBL::getInstance();
     // get Echelon db pointer
     $db = DB_B3::getPointer();
     // get B3 Db pointer
     $tables_array = explode(',', $tables);
     foreach ($tables_array as $table) {
         // check each table exists
         $query = "SELECT id FROM {$table} LIMIT 1";
         if (!($stmt = $db->mysql->prepare($query))) {
             // if table does not exist then prepare will fail
             return false;
         }
         // if not return false
     }
     // Update the tables row
     $result = $dbl->updateSettings($tables, 'chats_table_' . $game, 's');
     if (!$result) {
         $result = $dbl->setSettings($tables, 'chats_table_' . $game, 's');
         if (!$result) {
             return false;
         }
     }
     // update the names row
     $result = $dbl->updateSettings($names, 'chats_names_' . $game, 's');
     if (!$result) {
         $result = $dbl->setSettings($names, 'chats_names_' . $game, 's');
         if (!$result) {
             return false;
         }
     }
     return true;
 }
Ejemplo n.º 7
0
 /**
  * Takes password and generates salt and hash. Then updates their password in the DB
  *
  * @param string $password - the new password the user
  * @param int $user_id - the id of the user that is being edited
  * @param int $min_pw_len - min len of password
  * @return bool(true)/string(error)
  */
 function genAndSetNewPW($password, $user_id, $min_pw_len)
 {
     // get the DB instance pointer
     $dbl = DBL::getInstance();
     // check that the supplied password meets the required password policy for strong passwords
     if (!$this->pwStrength($password, $min_pw_len)) {
         // false: not strong enough
         return 'The password you supplied is not strong enough, a password must be longer than ' . $min_pw_len . ' character and should follow this <a href="http://echelon.bigbrotherbot.net/pw/" title="Echelon Password Policy">policy</a>.';
     }
     // generate a new salt for the user
     $salt_new = genSalt();
     // find the hash of the supplied password and the new salt
     $password_hash = genPW($password, $salt_new);
     // update the user with new password and new salt
     $results_pw = $dbl->editMePW($password_hash, $salt_new, $user_id);
     if ($results_pw == false) {
         return 'There was an error changing your password';
     } else {
         return true;
     }
 }
Ejemplo n.º 8
0
function mergeImages($img1, $img2)
{
    $imgDir = "img/";
    $newImg = $imgDir . substr($img1, 0, strlen($img1) - 4) . "_" . substr($img2, 0, strlen($img2) - 4) . ".gif";
    list($img1width, $img1height) = getimagesize($imgDir . $img1);
    // Size of source photo for resizing
    list($img2width, $img2height) = getimagesize($imgDir . $img2);
    // Size of source photo for resizing
    $imgFile1 = imagecreatefromgif($imgDir . $img1);
    $imgFile2 = imagecreatefromgif($imgDir . $img2);
    imagecopymerge($imgFile1, $imgFile2, 5, 5, 0, 0, $img2width, $img2height, 100);
    imagegif($imgFile1, $newImg) or die('Could not save picture! Please check permissions.');
    imagedestroy($imgFile1);
    imagedestroy($imgFile2);
}
$dblink = new DBL();
$strSQL = "SELECT resource.resource_name, resource.resource_img, tbl1.*, tbl2.aa_bonus_1m, tbl2.aa_count_1m,\r\ntbl3.aa_bonus_3m, tbl3.aa_count_3m, tbl4.aa_bonus_6m, tbl4.aa_count_6m FROM\r\n(SELECT artefact.resource_id, ROUND(SUM(artefact.artefact_bonus), 3) AS aa_bonus,\r\nCOUNT(player_artefact.artefact_id) AS aa_count\r\nFROM artefact, player_artefact\r\nWHERE player_artefact.artefact_id = artefact.artefact_id\r\nGROUP BY artefact.resource_id) AS tbl1 LEFT JOIN\r\n(SELECT artefact.resource_id, ROUND(SUM(artefact.artefact_bonus), 3) AS aa_bonus_1m,\r\nCOUNT(player_artefact.artefact_id) AS aa_count_1m\r\nFROM artefact, player_artefact\r\nWHERE player_artefact.artefact_id = artefact.artefact_id\r\nAND player_artefact.player_artefact_date<=UNIX_TIMESTAMP(CURRENT_DATE - INTERVAL 1 MONTH)\r\nGROUP BY artefact.resource_id) AS tbl2\r\nON tbl1.resource_id = tbl2.resource_id\r\nLEFT JOIN\r\n(SELECT artefact.resource_id, ROUND(SUM(artefact.artefact_bonus), 3) AS aa_bonus_3m,\r\nCOUNT(player_artefact.artefact_id) AS aa_count_3m\r\nFROM artefact, player_artefact\r\nWHERE player_artefact.artefact_id = artefact.artefact_id\r\nAND player_artefact.player_artefact_date<=UNIX_TIMESTAMP(CURRENT_DATE - INTERVAL 3 MONTH)\r\nGROUP BY artefact.resource_id) AS tbl3\r\nON tbl1.resource_id = tbl3.resource_id\r\nLEFT JOIN\r\n(SELECT artefact.resource_id, ROUND(SUM(artefact.artefact_bonus), 3) AS aa_bonus_6m,\r\nCOUNT(player_artefact.artefact_id) AS aa_count_6m\r\nFROM artefact, player_artefact\r\nWHERE player_artefact.artefact_id = artefact.artefact_id\r\nAND player_artefact.player_artefact_date<=UNIX_TIMESTAMP(CURRENT_DATE - INTERVAL 3 MONTH)\r\nGROUP BY artefact.resource_id) AS tbl4\r\nON tbl1.resource_id = tbl4.resource_id\r\nINNER JOIN resource ON tbl1.resource_id = resource.resource_id\r\nORDER BY tbl1.resource_id";
$rsAllianceBonus = $dblink->query($strSQL);
$strSQL = "SELECT artefact.*, artefact_size.artefact_size_name, artefact_size.artefact_size_img,\r\n\t\t\tartefact_type.artefact_type_name, artefact_type.artefact_type_img,\r\n\t\t\tplayer_artefact.player_artefact_id, resource.resource_name, resource.resource_img\r\n\t\t\tFROM player_artefact, artefact, artefact_size, artefact_type, resource\r\n\t\t\tWHERE player_artefact.artefact_id=artefact.artefact_id AND\r\n\t\t\tartefact.artefact_size_id=artefact_size.artefact_size_id AND\r\n\t\t\tartefact.artefact_type_id=artefact_type.artefact_type_id AND\r\n\t\t\tartefact_type.resource_id=resource.resource_id AND\r\n\t\t\tplayer_artefact.player_id=1\r\n\t\t\tORDER BY artefact_type.resource_id, artefact.artefact_size_id DESC";
$rsMyArtefacts = $dblink->query($strSQL);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Реестр Альянсовых Артефактов</title>
<link rel="stylesheet" href="templates/style.css" type="text/css">
<style>

.dialogBox
{
	background-color: #FFFFFF;