Beispiel #1
0
 function is_logged($type, $user)
 {
     if ($type == 'vainilla' and table_exist(plugin_name . "usuarios")) {
         return vainilla_is_login($user);
     } else {
         return wp_isLogin($user);
     }
     return false;
 }
Beispiel #2
0
    $num_rows = @mysql_num_rows($result);
    if ($num_rows) {
        return true;
    } else {
        return false;
    }
}
$doc = new Document();
$doc->begin("set MOTD", 1);
if (isset($bzID)) {
    $substr = explode("|", $bzID);
    $result = mysql_query("SELECT * FROM passwd WHERE password = '******'1']}' AND username = '******'0']}' AND access = '{$substr['2']}'");
    if (mysql_num_rows($result) == 1 && $substr[2] >= 1) {
        if (!isset($add)) {
            // check for the table
            if (!table_exist('motd')) {
                $query = "CREATE TABLE motd ( title varchar(80) NOT NULL default '', description varchar(255) NOT NULL default '', author varchar(64) NOT NULL default '', pubDate varchar(64) NOT NULL default '', version varchar(64) NOT NULL default '', id bigint(20) unsigned NOT NULL default 0 ) TYPE=MyISAM COMMENT='the current message';";
                $result = mysql_query($query);
                $query = "INSERT INTO motd (title, description, author, pubDate, version, id) values ('Welcome to BZFlag', 'BZFlag is a free multiplayer multiplatform 3D tank battle game. The name stands for Battle Zone capture Flag. It runs on Irix, Linux, BSD, Windows, Mac OS X and other platforms.', 'BZFlag Developers', '', '0.0', '0' )";
                $result = mysql_query($query);
            }
            $query = "SELECT * FROM motd";
            $result = mysql_query($query) or die("Query failed : " . mysql_error());
            $row = mysql_fetch_array($result);
            $currentMOTD = $row[message];
            // message
            print <<<end
CurrentMOTD: {$currentMOTD}</br>
<form method="post" action="setMOTD.php">
<input type="hidden" name="add" value="1">
<table cellspacing=10 cellpadding=0 border=0>
Beispiel #3
0
 function print_all_items_from_tables($t_name, $column = '*', $con_col = '', $com_element = '')
 {
     $query = 'order by id desc';
     $x = 0;
     if ($con_col != "" && $com_element != "") {
         $query = "where {$con_col}='{$com_element}'";
     }
     $sql = mysql_query("select {$column} from {$t_name} {$query}");
     $x++;
     $arr['titulo'] = $t_name;
     if (table_exist($t_name)) {
         while ($r = mysql_fetch_assoc($sql)) {
             $arr[$x] = $r;
             $x++;
         }
     }
     return $arr;
 }
Beispiel #4
0
    echo S_TCREATE . "loginattempts<br />";
    $result = mysql_call("create table loginattempts (\t\t\n    userattempt   VARCHAR(25) PRIMARY KEY,\t\t\n    passattempt  VARCHAR(250),\t\t\n    board  VARCHAR(250),\t\t\n    ip  VARCHAR(250),\t\t\n    attemptno  VARCHAR(50))");
    if (!$result) {
        echo S_TCREATEF . "loginattempts<br />";
    }
}
if (!table_exist(SQLMODSLOG)) {
    echo S_TCREATE . SQLMODSLOG . "<br />";
    $result = mysql_call("create table " . SQLMODSLOG . " (\t\t\n    user   VARCHAR(25) PRIMARY KEY,\t\t\n    password  VARCHAR(250),\t\t\n    allowed  VARCHAR(250),\t\t\n    denied  VARCHAR(250))");
    if (!$result) {
        echo S_TCREATEF . SQLMODSLOG . "<br />";
    }
    mysql_call("INSERT INTO " . SQLMODSLOG . " (user, password, allowed, denied) VALUES ('admin', 'guest', 'janitor_board,moderator,admin,manager', 'none') ");
    echo "Default account inserted. Username: admin, Passwor: guest.";
}
if (!table_exist(SQLDELLOG)) {
    echo S_TCREATE . SQLDELLOG . "<br />";
    $result = mysql_call("create table " . SQLDELLOG . " (\t\t\n    imgonly   VARCHAR(25) PRIMARY KEY,\t\t\n    postno  VARCHAR(250),\t\t\n    board  VARCHAR(250),\t\t\n    name  VARCHAR(250),\t\t\n    sub  VARCHAR(50),\t\t\n    com VARCHAR(" . S_POSTLENGTH . "),\t\t\n    img VARCHAR(250),\t\n    filename VARCHAR(250),\t\t\n    admin VARCHAR(100))");
    if (!$result) {
        echo S_TCREATEF . SQLDELLOG . "<br />";
    }
}
function prune_old()
{
    //This prunes old posts that are pushed off the bottom of last page, called once after each post is made in regist()
    log_cache();
    if (PAGE_MAX >= 1) {
        $maxposts = LOG_MAX;
        $maxthreads = PAGE_MAX > 0 ? PAGE_MAX * PAGE_DEF : 0;
        //number of pages x how many threads per page
        if ($maxthreads) {
Beispiel #5
0
    $res = mysql_query("SHOW TABLES LIKE '{$table_name}'");
    if ($res) {
        $row = mysql_fetch_row($res);
        if ($row && $row[0] == $table_name) {
            return true;
        }
    }
    return false;
}
include "db.php";
// load the map.sql via system command using "wget" into the folder data/
// IMPORTANT: PHP has to be allowed to write into that folder, if necessary set the needed rights!
$sqldump = "tmp.sql";
system('wget http://s1.travian.jp/map.sql.gz -O ' . $sqldump . '.gz');
system('gzip -d ' . $sqldump . '.gz');
if (table_exist('x_world')) {
    echo "Drop table x_world.\n";
    mysql_query("DROP TABLE x_world");
}
// Check whether the file has been downloaded and is larger than zero bytes
if (file_exists($sqldump) and filesize($sqldump)) {
    // Empty table
    $query = "CREATE TABLE `x_world` (\r\n\t\t\t  `id` int(9) unsigned NOT NULL default '0',\r\n\t\t\t  `x` smallint(3) NOT NULL default '0',\r\n\t\t\t  `y` smallint(3) NOT NULL default '0',\r\n\t\t\t  `tid` tinyint(1) unsigned NOT NULL default '0',\r\n\t\t\t  `vid` int(9) unsigned NOT NULL default '0',\r\n\t\t\t  `village` varbinary(255) NOT NULL default '',\r\n\t\t\t  `uid` int(9) NOT NULL default '0',\r\n\t\t\t  `player` varbinary(255) NOT NULL default '',\r\n\t\t\t  `aid` int(9) unsigned NOT NULL default '0',\r\n\t\t\t  `alliance` varbinary(255) NOT NULL default '',\r\n\t\t\t  `population` smallint(5) unsigned NOT NULL default '0'\r\n\t\t\t);";
    $result = @mysql_query($query);
    // Exceute map.sql using the programme "mysql"
    // IMPORTANT: The charset "latin1" has to be used for T2 game worlds (if there should be any left with that version)
    system('mysql --host=localhost --user=root --password= --default-character-set=utf8 test < ' . $sqldump);
    mysql_query("RENAME TABLE x_world TO x_world_" . date('Y_m_d'));
    echo 'Update finished!';
} else {
    echo 'Failed downloading map.sql or file is empty!';
function plugin_activate($id, $version, &$errors)
{
    global $conf;
    /* Cleaning obsolete files */
    /* *********************** */
    clean_obsolete_files();
    include_once UAM_PATH . 'include/upgradedb.inc.php';
    /* Check if old version is < 2.15 */
    /* ****************************** */
    $query = '
SELECT param
  FROM ' . CONFIG_TABLE . '
WHERE param = "nbc_UserAdvManager"
;';
    $count1 = pwg_db_num_rows(pwg_query($query));
    $query = '
SELECT *
  FROM ' . CONFIG_TABLE . '
WHERE param = "nbc_UserAdvManager_ConfirmMail"
;';
    $count2 = pwg_db_num_rows(pwg_query($query));
    /* If old params exist an upgrade is needed */
    /* **************************************** */
    if ($count1 == 1) {
        /* Check for upgrade from 2.10 to 2.11 */
        /* *********************************** */
        if ($count1 == 1 and $count2 == 0) {
            /* upgrade from branch 2.10 to 2.11 */
            /* ******************************** */
            upgrade_210_211();
        }
        /* Check for upgrade from 2.11 to 2.12 */
        /* *********************************** */
        if (!table_exist(USER_LASTVISIT_TABLE)) {
            /* upgrade from branch 2.11 to 2.12 */
            /* ******************************** */
            upgrade_211_212();
        }
        /* Check for upgrade from 2.12 to 2.13 */
        /* *********************************** */
        $fields = pwg_query('SHOW COLUMNS FROM ' . USER_CONFIRM_MAIL_TABLE . ';');
        $nb_fields = pwg_db_num_rows($fields);
        if ($nb_fields < 6) {
            /* upgrade from branch 2.12 to 2.13 */
            /* ******************************** */
            upgrade_212_213();
        }
        /* Serializing conf parameters - Available since 2.14.0 */
        /* **************************************************** */
        if (unserialize($conf['nbc_UserAdvManager']) === false) {
            /* upgrade from branch 2.13 to 2.14 */
            /* ******************************** */
            upgrade_213_214();
        }
        /* upgrade from branch 2.14 to 2.15 */
        /* ******************************** */
        upgrade_214_215();
    }
    /* Old version is > 2.15 */
    /* ********************* */
    $query = '
SELECT param
  FROM ' . CONFIG_TABLE . '
WHERE param = "UserAdvManager_Redir"
;';
    $count = pwg_db_num_rows(pwg_query($query));
    if ($count == 0) {
        upgrade_2153_2154();
    }
    /* Check for upgrade from 2.15 to 2.16 */
    /* *********************************** */
    $query = '
SELECT param
  FROM ' . CONFIG_TABLE . '
WHERE param = "UserAdvManager_Version"
;';
    $count = pwg_db_num_rows(pwg_query($query));
    if ($count == 0) {
        /* upgrade from branch 2.15 to 2.16 */
        /* ******************************** */
        upgrade_215_2160();
    }
    /* Check database upgrade since version 2.16.0 */
    /* ******************************************* */
    if (isset($conf['UserAdvManager_Version'])) {
        if (version_compare($conf['UserAdvManager_Version'], '2.20.0') < 0) {
            /* upgrade from branch 2.16 to 2.20 */
            /* ******************************** */
            upgrade_216_220();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.20.4') < 0) {
            /* upgrade from version 2.20.3 to 2.20.4 */
            /* ************************************* */
            upgrade_2203_2204();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.20.7') < 0) {
            /* upgrade from version 2.20.4 to 2.20.7 */
            /* ************************************* */
            upgrade_2204_2207();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.20.8') < 0) {
            /* upgrade from version 2.20.7 to 2.20.8 */
            /* ************************************* */
            upgrade_2207_2208();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.30.0') < 0) {
            /* upgrade from version 2.20.8 to 2.30.0 */
            /* ************************************* */
            upgrade_2208_2300();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.30.2') < 0) {
            /* upgrade from version 2.30.x to 2.30.2 */
            /* ************************************* */
            upgrade_2300_2302();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.40.0') < 0) {
            /* upgrade from version 2.30.x to 2.40.0 */
            /* ************************************* */
            upgrade_2300_2400();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.41.0') < 0) {
            /* upgrade from version 2.40.x to 2.41.0 */
            /* ************************************* */
            upgrade_2400_2410();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.50.0') < 0) {
            /* upgrade from version 2.41.x to 2.50.0 */
            /* ************************************* */
            upgrade_2410_2500();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.50.11') < 0) {
            /* upgrade from version 2.50.x to 2.50.11 */
            /* ************************************** */
            upgrade_2500_25011();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.51.0') < 0) {
            /* upgrade from version 2.50.x to 2.51.0 */
            /* ************************************* */
            upgrade_2500_2510();
        }
        if (version_compare($conf['UserAdvManager_Version'], '2.70.3') < 0) {
            /* upgrade from version 2.51.0 to 2.70.3 */
            /* ************************************* */
            upgrade_2510_2703();
        }
    }
    // Update plugin version number in #_config table and check consistency of #_plugins table
    // ---------------------------------------------------------------------------------------
    UAM_version_update();
    load_conf_from_db('param like \'UserAdvManager\\_%\'');
}