Damian1234

Miembro
LV
14
 
Awards
15
En todos los servers siempre vas a encontrar un cliente llamado localhost, este solo sirve para usarlo en modo local, el otro es para su modificación y ponerlo online.
Ohhh entiendo, entonces que puedo hacer amigo me sigue apareciendo este error y ya segui todos los tutoriales que me dijiste :(
 

Adjuntos

  • Duplicado.jpg
    Duplicado.jpg
    667,8 KB · Visitas: 5

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Ohhh entiendo, entonces que puedo hacer amigo me sigue apareciendo este error y ya segui todos los tutoriales que me dijiste :(
Hola,
Yo sé cual es el problema, puedes volver a descargar la web y cambiar el archivo config.countries y login.php y probar ?
 

acxel12

Miembro
LV
13
 
Awards
14
Hola,
Yo sé cual es el problema, puedes volver a descargar la web y cambiar el archivo config.countries y login.php y probar ?
Ya lo solucioné, hay un error en el login.php y connect.php.
Nos vamos a la carpeta del UniformServer/www/login.php lo abren con notepad y reemplazan por esto:
PHP:
<?php
require_once 'engine/init.php';

// Client 11 loginWebService
// DEV: Uncomment all //error_log lines and tail error.log file to see communication from and to client.
// ...: Configure webserver to don't display PHP errors/warnings so the client can parse the json response.
if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === 'TFS_10' && $config['login_web_service'] == true) {

    function sendError($message, $code = 3) {
        $response = json_encode(array('errorCode' => $code, 'errorMessage' => $message));
        //error_log("\nServer = " . $response . "\n-");
        die($response);
    }

    function sendMessage($message) {
        $response = json_encode($message);
        //error_log("\nServer = " . $response . "\n\n-");
        die($response);
    }


    header("Content-Type: application/json");
    $input = file_get_contents("php://input");
    //error_log("\n\n\nClient = " . $input . "\n");

    $client = json_decode($input);

    if (!isset($client->type)) {
        sendError("Type missing.");
    }

    switch($client->type) {
        // {"count":0,"isreturner":true,"offset":0,"showrewardnews":false,"type":"news"}
        case "cacheinfo":
            // {"type":"cacheinfo"}
            sendMessage(array(
                'playersonline' => (int)user_count_online(),
                'twitchstreams' => 0,
                'twitchviewer' => 0,
                'gamingyoutubestreams' => 0,
                'gamingyoutubeviewer' => 0
            ));
            break;
       
       
        case 'boostedcreature':
                $boostDB = mysql_select_multi("SELECT * FROM `boosted_creature`");
                $creatureBoost = [];
                foreach ($boostDB as $boost) {
                    $creatureBoost[] = $boost;
                }
           
                $boostDB = mysql_select_multi("SELECT * FROM `boosted_boss`");
                $bossBoost = [];
                foreach ($boostDB as $boost) {
                    $bossBoost[] = $boost;
                }
           
                die(json_encode([
                    'boostedcreature' => true,
                    'bossraceid' => intval($bossBoost[0]['raceid']),
                    'creatureraceid' => intval($creatureBoost[0]['raceid']),
                ]));
                break;

               
               
        case 'eventschedule':
            // {"type":"eventschedule"}
            $eventlist = [];
                $file_path = $config['server_path'] . 'data/XML/events.xml';
                /*  <?xml version="1.0" encoding="UTF-8"?>
                    <events>
                        <event name="Otservbr example 1" startdate="11/03/2020" enddate="11/30/2020" >
                            <ingame exprate="250" lootrate="200" spawnrate="100" skillrate="200" />
                            <description description="Otserver br example 1 description double exp and a half, double loot !chance!, regular spawn and double skill" />
                            <colors colordark="#235c00" colorlight="#2d7400" />
                            <details displaypriority="6" isseasonal="0" specialevent="0" />
                        </event>
                        <event name="Otservbr example 2" startdate="12/01/2020" enddate="12/26/2020" >
                            <ingame exprate="50" lootrate="300" spawnrate="150" skillrate="100" />
                            <description description="Otserver br example 2 description 50% less exp, triple loot !chance!, 50% faster spawn and regular skill" />
                            <colors colordark="#735D10" colorlight="#8B6D05" />
                            <details displaypriority="6" isseasonal="0" specialevent="0" />
                        </event>
                    </events>
                */
                if (!file_exists($file_path)) {
                    sendMessage(array(
                        'eventlist' => array()
                    ));
                }
                $xml = new DOMDocument;
                $xml->load($file_path);
                $tableevent = $xml->getElementsByTagName('event');

                if (!function_exists("parseEvent")) {
                    function parseEvent($table1, $date, $table2) {
                        if ($table1) {
                            if ($date) {
                                if ($table2) {
                                    $date = $table1->getAttribute('startdate');
                                    return date_create("{$date}")->format('U');
                                } else {
                                    $date = $table1->getAttribute('enddate');
                                    return date_create("{$date}")->format('U');
                                }
                            } else {
                                foreach($table1 as $attr) {
                                    if ($attr) {
                                        return $attr->getAttribute($table2);
                                    }
                                }
                            }
                        }
                        return;
                    }
                }

                foreach ($tableevent as $event) {
                    if ($event) {
                        $eventlist[] = array(
                            'colorlight' => parseEvent($event->getElementsByTagName('colors'), false, 'colorlight'),
                            'colordark' => parseEvent($event->getElementsByTagName('colors'), false, 'colordark'),
                            'description' => parseEvent($event->getElementsByTagName('description'), false, 'description'),
                            'displaypriority' => intval(parseEvent($event->getElementsByTagName('details'), false, 'displaypriority')),
                            'enddate' => intval(parseEvent($event, true, false)),
                            'isseasonal' => (intval(parseEvent($event->getElementsByTagName('details'), false, 'isseasonal')) == 1) ? true : false,
                            'name' => $event->getAttribute('name'),
                            'startdate' => intval(parseEvent($event, true, true)),
                            'specialevent' => intval(parseEvent($event->getElementsByTagName('details'), false, 'specialevent'))
                        );
                    }
                }

                sendMessage(array(
                    'eventlist' => $eventlist,
                    'lastupdatetimestamp' => time()
                ));
            break;


            case 'news':
            // {"count":0,"isreturner":true,"offset":0,"showrewardnews":false,"type":"news"}
            sendMessage(array(
                'gamenews' => array(), // element structure?
                'categorycounts' => array(
                    'support' => 1,
                    'game contents' => 2,
                    'useful info' => 3,
                    'major updates' => 4,
                    'client features' => 5
                ),
                'maxeditdate' => 1590979202
            ));
            break;

        case "login":
            /* {
                'accountname' => 'username',
                "email":"my@email.com",
                'password' => 'superpass',
                'stayloggedin' => true,
                'token' => '123123', (or not set)
                'type' => 'login',
            } */

            $email = (isset($client->email)) ? sanitize($client->email) : false;
            $username = (isset($client->accountname)) ? sanitize($client->accountname) : false;
            $password = SHA1($client->password);
            $token = (isset($client->token)) ? sanitize($client->token) : false;

            $fields = '`id`, `premdays`';
            if ($config['twoFactorAuthenticator']) $fields .= ', `secret`';

            $account = false;

            if ($email !== false) {
                $fields .= ', `name`';
                $account = mysql_select_single("SELECT {$fields} FROM `accounts` WHERE `email`='{$email}' AND `password`='{$password}' LIMIT 1;");
                if ($account !== false) {
                    $username = $account['name'];
                }
            } elseif ($username !== false) {
                $account = mysql_select_single("SELECT {$fields} FROM `accounts` WHERE `name`='{$username}' AND `password`='{$password}' LIMIT 1;");
            }

            if ($account === false) {
                sendError('Wrong username and/or password.');
            }

            if ($config['twoFactorAuthenticator'] === true && $account['secret'] !== null) {
                if ($token === false) {
                    sendError('Submit a valid two-factor authentication token.', 6);
                } else {
                    require_once("engine/function/rfc6238.php");
                    if (TokenAuth6238::verify($account['secret'], $token) !== true) {
                        sendError('Two-factor authentication failed, token is wrong.', 6);
                    }
                }
            }

            $players = mysql_select_multi("SELECT `name`, `*********************`, `level`, `vocation`, `lookbody`, `looktype`, `lookhead`, `looklegs`, `lookfeet`, `lookaddons`, `deletion` FROM `players` WHERE `account_id`='".$account['id']."';");
            if ($players !== false) {

                $gameserver = $config['gameserver'];
                // Override $config['gameserver'] if server has installed Lua script for loginWebService
                $sql_elements = mysql_select_multi("
                    SELECT
                        `key`,
                        `value`
                    FROM `znote_global_storage`
                    WHERE `key` IN('SERVER_NAME', 'IP', 'GAME_PORT')
                ");
                if ($sql_elements !== false) {
                    foreach ($sql_elements AS $element) {
                        switch ($element['key']) {
                            case 'SERVER_NAME':
                                $gameserver['name'] = $element['value'];
                                break;
                            case 'IP':
                                $gameserver['ip'] = $element['value'];
                                break;
                            case 'GAME_PORT':
                                $gameserver['port'] = (int)$element['value'];
                                break;
                        }
                    }
                }

                $sessionKey = ($email !== false) ? $email."\n".$client->password : $username."\n".$client->password;
                if (isset($account['secret']) && strlen($account['secret']) > 5) $sessionKey .= "\n".$token."\n".floor(time() / 30);

                $response = array(
                    'session' => array(
                        'fpstracking' => false,
                        'optiontracking' => false,
                        'isreturner' => true,
                        'returnernotification' => false,
                        'showrewardnews' => false,
                        'tournamentticketpurchasestate' => 0,
                        'emailcoderequest' => false,
                        'sessionkey' => $sessionKey,
                        'lastlogintime' => 0,
                        'ispremium' => ($account['premdays'] > 0) ? true : false,
                        'premiumuntil' => time() + ($account['premdays'] * 86400),
                        'status' => 'active'
                    ),
                    'playdata' => array(
                        'worlds' => array(
                            array(
                                'id' => 0,
                                'name' => $gameserver['name'],
                                'externaladdress' => $gameserver['ip'],
                                'externalport' => $gameserver['port'],
                                'previewstate' => 0,
                                'location' => 'ALL',
                                'pvptype' => 'pvp',
                                'externaladdressunprotected' => $gameserver['ip'],
                                'externaladdressprotected' => $gameserver['ip'],
                                'externalportunprotected' => $gameserver['port'],
                                'externalportprotected' => $gameserver['port'],
                                'istournamentworld' => false,
                                'restrictedstore' => false,
                                'currenttournamentphase' => 2,
                                'anticheatprotection' => false
                            )
                        ),
                        'characters' => array(
                            //array( 'worldid' => ASD, 'name' => asd, 'ismale' => true, 'tutorial' => false ),
                        )
                    )
                );

                foreach ($players as $player) {
                    $response['playdata']['characters'][] = array(
                        'worldid' => 0,
                        'name' => $player['name'],
                        'ismale' => ($player['*********************'] === 1) ? true : false,
                        'tutorial' => false,
                        'level' => intval($player['level']),
                        'vocation' => vocation_id_to_name($player['vocation']),
                        'outfitid' => intval($player['looktype']),
                        'headcolor' => intval($player['lookhead']),
                        'torsocolor' => intval($player['lookbody']),
                        'legscolor' => intval($player['looklegs']),
                        'detailcolor' => intval($player['lookfeet']),
                        'addonsflags' => intval($player['lookaddons']),
                        'ishidden' => intval($player['deletion']) === 1,
                        'istournamentparticipant' => false,
                        'remainingdailytournamentplaytime' => 0
                    );
                }

                sendMessage($response);
            } else {
                sendError("Character list is empty.");
            }
            break;

        default:
            sendError("Unsupported type: " . sanitize($client->type));
    }

} // End client 11 loginWebService

logged_in_redirect();
include 'layout/overall/header.php';

if (empty($_POST) === false) {

    if ($config['log_ip']) {
        znote_visitor_insert_detailed_data(5);
    }

    $username = $_POST['username'];
    $password = $_POST['password'];

    if (empty($username) || empty($password)) {
        $errors[] = 'You need to enter a username and password.';
    } else if (strlen($username) > 32 || strlen($password) > 64) {
            $errors[] = 'Username or password is too long.';
    } else if (user_exist($username) === false) {
        $errors[] = 'Failed to authorize your account, are the details correct, have you created an <a href=\'register.php\'>account</a>?';
    } /*else if (user_activated($username) === false) {
        $errors[] = 'You havent activated your account! Please check your email. <br>Note it may appear in your junk/spam box.';
    } */else if ($config['use_token'] && !Token::isValid($_POST['token'])) {
        Token::debug($_POST['token']);
        $errors[] = 'Token is invalid.';
    } else {

        // Starting loging
        if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $login = user_login($username, $password);
        else if ($config['ServerEngine'] == 'TFS_03') $login = user_login_03($username, $password);
        else $login = false;
        if ($login === false) {
            $errors[] = 'Username and password combination is wrong.';
        } else {
            // Check if user have access to login
            $status = false;
            if ($config['mailserver']['register']) {
                $authenticate = mysql_select_single("SELECT `id` FROM `znote_accounts` WHERE `account_id`='$login' AND `active`='1' LIMIT 1;");
                if ($authenticate !== false) {
                    $status = true;
                } else {
                    $errors[] = "Your account is not activated. An email should have been sent to you when you registered. Please find it and click the activation link to activate your account.";
                }
            } else $status = true;

            if ($status) {
                // Regular login success, now lets check authentication token code
                if ($config['ServerEngine'] == 'TFS_10' && $config['twoFactorAuthenticator']) {
                    require_once("engine/function/rfc6238.php");

                    // Two factor authentication code / token
                    $authcode = (isset($_POST['authcode'])) ? getValue($_POST['authcode']) : false;

                    // Load secret values from db
                    $query = mysql_select_single("SELECT `a`.`secret` AS `secret`, `za`.`secret` AS `znote_secret` FROM `accounts` AS `a` INNER JOIN `znote_accounts` AS `za` ON `a`.`id` = `za`.`account_id` WHERE `a`.`id`='".(int)$login."' LIMIT 1;");

                    // If account table HAS a secret, we need to validate it
                    if ($query['secret'] !== NULL) {

                        // Validate the secret first to make sure all is good.
                        if (TokenAuth6238::verify($query['secret'], $authcode) !== true) {
                            $errors[] = "Submitted Two-Factor Authentication token is wrong.";
                            $errors[] = "Make sure to type the correct token from your mobile authenticator.";
                            $status = false;
                        }

                    } else {

                        // secret from accounts table is null/not set. Perhaps we can activate it:
                        if ($query['znote_secret'] !== NULL && $authcode !== false && !empty($authcode)) {

                            // Validate the secret first to make sure all is good.
                            if (TokenAuth6238::verify($query['znote_secret'], $authcode)) {
                                // Success, enable the 2FA system
                                mysql_update("UPDATE `accounts` SET `secret`= '".$query['znote_secret']."' WHERE `id`='$login';");
                            } else {
                                $errors[] = "Activating Two-Factor authentication failed.";
                                $errors[] = "Try to login without token and configure your app properly.";
                                $errors[] = "Submitted Two-Factor Authentication token is wrong.";
                                $errors[] = "Make sure to type the correct token from your mobile authenticator.";
                                $status = false;
                            }
                        }
                    }
                } // End tfs 1.0+ with 2FA auth

                if ($status) {
                    setSession('user_id', $login);

                    // if IP is not set (etc acc created before Znote AAC was in use)
                    $znote_data = user_znote_account_data($login, 'ip');
                    if ($znote_data['ip'] == 0) {
                        $update_data = array(
                        'ip' => getIPLong(),
                        );
                        user_update_znote_account($update_data);
                    }

                    // Send them to myaccount.php
                    header('Location: myaccount.php');
                    exit();
                }
            }
        }
    }
} else {
    header('Location: index.php');
}

if (empty($errors) === false) {
    ?>
    <div id="news" class="Box">

<div class="Corner-tl" style="background-image:url(layout/images/global/content/corner-tl.gif);"></div>
<div class="Corner-tr" style="background-image:url(layout/images/global/content/corner-tr.gif);"></div>
<div class="Border_1" style="background-image:url(layout/images/global/content/border-1.gif);"></div>
<div class="BorderTitleText" style="background-image:url(layout/images/global/content/title-background-green.gif);"></div>
<img id="ContentBoxHeadline" class="Title" src="layout/images/global/images/downloads.png" alt="Contentbox headline" />
<div class="Border_2">
    <div class="Border_3">
        <div class="BoxContent" style="background-image:url(layout/images/global/content/scroll.gif);">
            <div class="SmallBox">
    <div class="MessageContainer">
                    <div class="BoxFrameHorizontal" style="background-image:url(layout/images/global/images/box-frame-horizontal.gif);"></div>
                    <div class="BoxFrameEdgeLeftTop" style="background-image:url(layout/images/global/images/box-frame-edge.gif);"></div>
                    <div class="BoxFrameEdgeRightTop" style="background-image:url(layout/images/global/images/box-frame-edge.gif);"></div>
                    <div class="Message">
                        <div class="BoxFrameVerticalLeft" style="background-image:url(layout/images/global/images/box-frame-vertical.gif);"></div>
                        <div class="BoxFrameVerticalRight" style="background-image:url(layout/images/global/images/box-frame-vertical.gif);"></div>
    <h2>We tried to log you in, but...</h2>


    <?php
    header("HTTP/1.1 401 Not Found");
    echo output_errors($errors);
} ?></div><div class="BoxFrameHorizontal" style="background-image:url(layout/images/global/images/box-frame-horizontal.gif);"></div>
<div class="BoxFrameEdgeRightBottom" style="background-image:url(layout/images/global/images/box-frame-edge.gif);"></div>
<div class="BoxFrameEdgeLeftBottom" style="background-image:url(layout/images/global/images/box-frame-edge.gif);"></div>
</div>
</div>
<?php include 'layout/overall/footer.php'; ?>

Luego en la misma carpeta del uniserver www/engine/database/connect.php, abrimos ese archivo con notepad, borramos todo lo que tenga adentro y pegamos esto:
PHP:
<?php
$time = time();
if (!isset($version)) $version = '1.5_SVN';

if (!function_exists("elapsedTime")) {
    function elapsedTime($l_start = false, $l_time = false) {
        if ($l_start === false) global $l_start;
        if ($l_time === false) global $l_time;

        $l_time = explode(' ', microtime());
        $l_finish = $l_time[1] + $l_time[0];
        return round(($l_finish - $l_start), 4);
    }
}

// ALTER TABLE `znote_accounts` ADD `active_email` TINYINT(4) NOT NULL DEFAULT '0' AFTER `active`;

$install = "
<h2>Install:</h2>
<ol>
    <li>
        <p>
            Make sure you have imported TFS database. (OTdir/schema.sql OR OTdir/schemas/mysql.sql OR OTdir/forgottenserver.sql)
        </p>
    </li>
    <li>Import the <a href='/engine/database/znote_schema.sql'>Znote AAC schema</a> to a <b>TFS database in phpmyadmin</b>.</li>
    <li>
        <p>
            Edit config.php with correct mysql connection details.
        </p>
    </li>
</ol>
";

$connect = new mysqli($config['sqlHost'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);

if ($connect->connect_errno) {
    die("Failed to connect to MySQL: (" . $connect->connect_errno . ") " . $connect->connect_error . $install);
}

function mysql_znote_escape_string($escapestr) {
    global $connect;
    return mysqli_real_escape_string($connect, $escapestr);
}

// Select single row from database
function mysql_select_single($query) {
    global $connect;
    global $aacQueries;
    $aacQueries++;

    global $accQueriesData;
    $accQueriesData[] = "[" . elapsedTime() . "] " . $query;
    $result = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_single</b> (select single row from database)<br><br>".mysqli_error($connect));
    $row = mysqli_fetch_assoc($result);
    return !empty($row) ? $row : false;
}

// Selecting multiple rows from database.
function mysql_select_multi($query){
    global $connect;
    global $aacQueries;
    $aacQueries++;
    global $accQueriesData;
    $accQueriesData[] = "[" . elapsedTime() . "] " . $query;
    $array = array();
    $results = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_multi</b> (select multiple rows from database)<br><br>".mysqli_error($connect));
    while($row = mysqli_fetch_assoc($results)) {
        $array[] = $row;
    }
    return !empty($array) ? $array : false;
}

//////
// Query database without expecting returned results

// - mysql update
function mysql_update($query){ voidQuery($query); }
// mysql insert
function mysql_insert($query){ voidQuery($query); }
// mysql delete
function mysql_delete($query){ voidQuery($query); }
// Send a void query
function voidQuery($query) {
    global $connect;
    global $aacQueries;
    $aacQueries++;
    global $accQueriesData;
    $accQueriesData[] = "[" . elapsedTime() . "] " . $query;
    mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>voidQuery</b> (voidQuery is used for update, insert or delete from database)<br><br>".mysqli_error($connect));
}
?>
Por último corremos la consola y ya nos tendría que dejar entrar. este procedimiento fue hecho con el servidor de hellgrave.
 

Damian1234

Miembro
LV
14
 
Awards
15
Ya lo solucioné, hay un error en el login.php y connect.php.
Nos vamos a la carpeta del UniformServer/www/login.php lo abren con notepad y reemplazan por esto:
PHP:
<?php
require_once 'engine/init.php';

// Client 11 loginWebService
// DEV: Uncomment all //error_log lines and tail error.log file to see communication from and to client.
// ...: Configure webserver to don't display PHP errors/warnings so the client can parse the json response.
if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === 'TFS_10' && $config['login_web_service'] == true) {

    function sendError($message, $code = 3) {
        $response = json_encode(array('errorCode' => $code, 'errorMessage' => $message));
        //error_log("\nServer = " . $response . "\n-");
        die($response);
    }

    function sendMessage($message) {
        $response = json_encode($message);
        //error_log("\nServer = " . $response . "\n\n-");
        die($response);
    }


    header("Content-Type: application/json");
    $input = file_get_contents("php://input");
    //error_log("\n\n\nClient = " . $input . "\n");

    $client = json_decode($input);

    if (!isset($client->type)) {
        sendError("Type missing.");
    }

    switch($client->type) {
        // {"count":0,"isreturner":true,"offset":0,"showrewardnews":false,"type":"news"}
        case "cacheinfo":
            // {"type":"cacheinfo"}
            sendMessage(array(
                'playersonline' => (int)user_count_online(),
                'twitchstreams' => 0,
                'twitchviewer' => 0,
                'gamingyoutubestreams' => 0,
                'gamingyoutubeviewer' => 0
            ));
            break;
      
      
        case 'boostedcreature':
                $boostDB = mysql_select_multi("SELECT * FROM `boosted_creature`");
                $creatureBoost = [];
                foreach ($boostDB as $boost) {
                    $creatureBoost[] = $boost;
                }
          
                $boostDB = mysql_select_multi("SELECT * FROM `boosted_boss`");
                $bossBoost = [];
                foreach ($boostDB as $boost) {
                    $bossBoost[] = $boost;
                }
          
                die(json_encode([
                    'boostedcreature' => true,
                    'bossraceid' => intval($bossBoost[0]['raceid']),
                    'creatureraceid' => intval($creatureBoost[0]['raceid']),
                ]));
                break;

              
              
        case 'eventschedule':
            // {"type":"eventschedule"}
            $eventlist = [];
                $file_path = $config['server_path'] . 'data/XML/events.xml';
                /*  <?xml version="1.0" encoding="UTF-8"?>
                    <events>
                        <event name="Otservbr example 1" startdate="11/03/2020" enddate="11/30/2020" >
                            <ingame exprate="250" lootrate="200" spawnrate="100" skillrate="200" />
                            <description description="Otserver br example 1 description double exp and a half, double loot !chance!, regular spawn and double skill" />
                            <colors colordark="#235c00" colorlight="#2d7400" />
                            <details displaypriority="6" isseasonal="0" specialevent="0" />
                        </event>
                        <event name="Otservbr example 2" startdate="12/01/2020" enddate="12/26/2020" >
                            <ingame exprate="50" lootrate="300" spawnrate="150" skillrate="100" />
                            <description description="Otserver br example 2 description 50% less exp, triple loot !chance!, 50% faster spawn and regular skill" />
                            <colors colordark="#735D10" colorlight="#8B6D05" />
                            <details displaypriority="6" isseasonal="0" specialevent="0" />
                        </event>
                    </events>
                */
                if (!file_exists($file_path)) {
                    sendMessage(array(
                        'eventlist' => array()
                    ));
                }
                $xml = new DOMDocument;
                $xml->load($file_path);
                $tableevent = $xml->getElementsByTagName('event');

                if (!function_exists("parseEvent")) {
                    function parseEvent($table1, $date, $table2) {
                        if ($table1) {
                            if ($date) {
                                if ($table2) {
                                    $date = $table1->getAttribute('startdate');
                                    return date_create("{$date}")->format('U');
                                } else {
                                    $date = $table1->getAttribute('enddate');
                                    return date_create("{$date}")->format('U');
                                }
                            } else {
                                foreach($table1 as $attr) {
                                    if ($attr) {
                                        return $attr->getAttribute($table2);
                                    }
                                }
                            }
                        }
                        return;
                    }
                }

                foreach ($tableevent as $event) {
                    if ($event) {
                        $eventlist[] = array(
                            'colorlight' => parseEvent($event->getElementsByTagName('colors'), false, 'colorlight'),
                            'colordark' => parseEvent($event->getElementsByTagName('colors'), false, 'colordark'),
                            'description' => parseEvent($event->getElementsByTagName('description'), false, 'description'),
                            'displaypriority' => intval(parseEvent($event->getElementsByTagName('details'), false, 'displaypriority')),
                            'enddate' => intval(parseEvent($event, true, false)),
                            'isseasonal' => (intval(parseEvent($event->getElementsByTagName('details'), false, 'isseasonal')) == 1) ? true : false,
                            'name' => $event->getAttribute('name'),
                            'startdate' => intval(parseEvent($event, true, true)),
                            'specialevent' => intval(parseEvent($event->getElementsByTagName('details'), false, 'specialevent'))
                        );
                    }
                }

                sendMessage(array(
                    'eventlist' => $eventlist,
                    'lastupdatetimestamp' => time()
                ));
            break;


            case 'news':
            // {"count":0,"isreturner":true,"offset":0,"showrewardnews":false,"type":"news"}
            sendMessage(array(
                'gamenews' => array(), // element structure?
                'categorycounts' => array(
                    'support' => 1,
                    'game contents' => 2,
                    'useful info' => 3,
                    'major updates' => 4,
                    'client features' => 5
                ),
                'maxeditdate' => 1590979202
            ));
            break;

        case "login":
            /* {
                'accountname' => 'username',
                "email":"my@email.com",
                'password' => 'superpass',
                'stayloggedin' => true,
                'token' => '123123', (or not set)
                'type' => 'login',
            } */

            $email = (isset($client->email)) ? sanitize($client->email) : false;
            $username = (isset($client->accountname)) ? sanitize($client->accountname) : false;
            $password = SHA1($client->password);
            $token = (isset($client->token)) ? sanitize($client->token) : false;

            $fields = '`id`, `premdays`';
            if ($config['twoFactorAuthenticator']) $fields .= ', `secret`';

            $account = false;

            if ($email !== false) {
                $fields .= ', `name`';
                $account = mysql_select_single("SELECT {$fields} FROM `accounts` WHERE `email`='{$email}' AND `password`='{$password}' LIMIT 1;");
                if ($account !== false) {
                    $username = $account['name'];
                }
            } elseif ($username !== false) {
                $account = mysql_select_single("SELECT {$fields} FROM `accounts` WHERE `name`='{$username}' AND `password`='{$password}' LIMIT 1;");
            }

            if ($account === false) {
                sendError('Wrong username and/or password.');
            }

            if ($config['twoFactorAuthenticator'] === true && $account['secret'] !== null) {
                if ($token === false) {
                    sendError('Submit a valid two-factor authentication token.', 6);
                } else {
                    require_once("engine/function/rfc6238.php");
                    if (TokenAuth6238::verify($account['secret'], $token) !== true) {
                        sendError('Two-factor authentication failed, token is wrong.', 6);
                    }
                }
            }

            $players = mysql_select_multi("SELECT `name`, `*********************`, `level`, `vocation`, `lookbody`, `looktype`, `lookhead`, `looklegs`, `lookfeet`, `lookaddons`, `deletion` FROM `players` WHERE `account_id`='".$account['id']."';");
            if ($players !== false) {

                $gameserver = $config['gameserver'];
                // Override $config['gameserver'] if server has installed Lua script for loginWebService
                $sql_elements = mysql_select_multi("
                    SELECT
                        `key`,
                        `value`
                    FROM `znote_global_storage`
                    WHERE `key` IN('SERVER_NAME', 'IP', 'GAME_PORT')
                ");
                if ($sql_elements !== false) {
                    foreach ($sql_elements AS $element) {
                        switch ($element['key']) {
                            case 'SERVER_NAME':
                                $gameserver['name'] = $element['value'];
                                break;
                            case 'IP':
                                $gameserver['ip'] = $element['value'];
                                break;
                            case 'GAME_PORT':
                                $gameserver['port'] = (int)$element['value'];
                                break;
                        }
                    }
                }

                $sessionKey = ($email !== false) ? $email."\n".$client->password : $username."\n".$client->password;
                if (isset($account['secret']) && strlen($account['secret']) > 5) $sessionKey .= "\n".$token."\n".floor(time() / 30);

                $response = array(
                    'session' => array(
                        'fpstracking' => false,
                        'optiontracking' => false,
                        'isreturner' => true,
                        'returnernotification' => false,
                        'showrewardnews' => false,
                        'tournamentticketpurchasestate' => 0,
                        'emailcoderequest' => false,
                        'sessionkey' => $sessionKey,
                        'lastlogintime' => 0,
                        'ispremium' => ($account['premdays'] > 0) ? true : false,
                        'premiumuntil' => time() + ($account['premdays'] * 86400),
                        'status' => 'active'
                    ),
                    'playdata' => array(
                        'worlds' => array(
                            array(
                                'id' => 0,
                                'name' => $gameserver['name'],
                                'externaladdress' => $gameserver['ip'],
                                'externalport' => $gameserver['port'],
                                'previewstate' => 0,
                                'location' => 'ALL',
                                'pvptype' => 'pvp',
                                'externaladdressunprotected' => $gameserver['ip'],
                                'externaladdressprotected' => $gameserver['ip'],
                                'externalportunprotected' => $gameserver['port'],
                                'externalportprotected' => $gameserver['port'],
                                'istournamentworld' => false,
                                'restrictedstore' => false,
                                'currenttournamentphase' => 2,
                                'anticheatprotection' => false
                            )
                        ),
                        'characters' => array(
                            //array( 'worldid' => ASD, 'name' => asd, 'ismale' => true, 'tutorial' => false ),
                        )
                    )
                );

                foreach ($players as $player) {
                    $response['playdata']['characters'][] = array(
                        'worldid' => 0,
                        'name' => $player['name'],
                        'ismale' => ($player['*********************'] === 1) ? true : false,
                        'tutorial' => false,
                        'level' => intval($player['level']),
                        'vocation' => vocation_id_to_name($player['vocation']),
                        'outfitid' => intval($player['looktype']),
                        'headcolor' => intval($player['lookhead']),
                        'torsocolor' => intval($player['lookbody']),
                        'legscolor' => intval($player['looklegs']),
                        'detailcolor' => intval($player['lookfeet']),
                        'addonsflags' => intval($player['lookaddons']),
                        'ishidden' => intval($player['deletion']) === 1,
                        'istournamentparticipant' => false,
                        'remainingdailytournamentplaytime' => 0
                    );
                }

                sendMessage($response);
            } else {
                sendError("Character list is empty.");
            }
            break;

        default:
            sendError("Unsupported type: " . sanitize($client->type));
    }

} // End client 11 loginWebService

logged_in_redirect();
include 'layout/overall/header.php';

if (empty($_POST) === false) {

    if ($config['log_ip']) {
        znote_visitor_insert_detailed_data(5);
    }

    $username = $_POST['username'];
    $password = $_POST['password'];

    if (empty($username) || empty($password)) {
        $errors[] = 'You need to enter a username and password.';
    } else if (strlen($username) > 32 || strlen($password) > 64) {
            $errors[] = 'Username or password is too long.';
    } else if (user_exist($username) === false) {
        $errors[] = 'Failed to authorize your account, are the details correct, have you created an <a href=\'register.php\'>account</a>?';
    } /*else if (user_activated($username) === false) {
        $errors[] = 'You havent activated your account! Please check your email. <br>Note it may appear in your junk/spam box.';
    } */else if ($config['use_token'] && !Token::isValid($_POST['token'])) {
        Token::debug($_POST['token']);
        $errors[] = 'Token is invalid.';
    } else {

        // Starting loging
        if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $login = user_login($username, $password);
        else if ($config['ServerEngine'] == 'TFS_03') $login = user_login_03($username, $password);
        else $login = false;
        if ($login === false) {
            $errors[] = 'Username and password combination is wrong.';
        } else {
            // Check if user have access to login
            $status = false;
            if ($config['mailserver']['register']) {
                $authenticate = mysql_select_single("SELECT `id` FROM `znote_accounts` WHERE `account_id`='$login' AND `active`='1' LIMIT 1;");
                if ($authenticate !== false) {
                    $status = true;
                } else {
                    $errors[] = "Your account is not activated. An email should have been sent to you when you registered. Please find it and click the activation link to activate your account.";
                }
            } else $status = true;

            if ($status) {
                // Regular login success, now lets check authentication token code
                if ($config['ServerEngine'] == 'TFS_10' && $config['twoFactorAuthenticator']) {
                    require_once("engine/function/rfc6238.php");

                    // Two factor authentication code / token
                    $authcode = (isset($_POST['authcode'])) ? getValue($_POST['authcode']) : false;

                    // Load secret values from db
                    $query = mysql_select_single("SELECT `a`.`secret` AS `secret`, `za`.`secret` AS `znote_secret` FROM `accounts` AS `a` INNER JOIN `znote_accounts` AS `za` ON `a`.`id` = `za`.`account_id` WHERE `a`.`id`='".(int)$login."' LIMIT 1;");

                    // If account table HAS a secret, we need to validate it
                    if ($query['secret'] !== NULL) {

                        // Validate the secret first to make sure all is good.
                        if (TokenAuth6238::verify($query['secret'], $authcode) !== true) {
                            $errors[] = "Submitted Two-Factor Authentication token is wrong.";
                            $errors[] = "Make sure to type the correct token from your mobile authenticator.";
                            $status = false;
                        }

                    } else {

                        // secret from accounts table is null/not set. Perhaps we can activate it:
                        if ($query['znote_secret'] !== NULL && $authcode !== false && !empty($authcode)) {

                            // Validate the secret first to make sure all is good.
                            if (TokenAuth6238::verify($query['znote_secret'], $authcode)) {
                                // Success, enable the 2FA system
                                mysql_update("UPDATE `accounts` SET `secret`= '".$query['znote_secret']."' WHERE `id`='$login';");
                            } else {
                                $errors[] = "Activating Two-Factor authentication failed.";
                                $errors[] = "Try to login without token and configure your app properly.";
                                $errors[] = "Submitted Two-Factor Authentication token is wrong.";
                                $errors[] = "Make sure to type the correct token from your mobile authenticator.";
                                $status = false;
                            }
                        }
                    }
                } // End tfs 1.0+ with 2FA auth

                if ($status) {
                    setSession('user_id', $login);

                    // if IP is not set (etc acc created before Znote AAC was in use)
                    $znote_data = user_znote_account_data($login, 'ip');
                    if ($znote_data['ip'] == 0) {
                        $update_data = array(
                        'ip' => getIPLong(),
                        );
                        user_update_znote_account($update_data);
                    }

                    // Send them to myaccount.php
                    header('Location: myaccount.php');
                    exit();
                }
            }
        }
    }
} else {
    header('Location: index.php');
}

if (empty($errors) === false) {
    ?>
    <div id="news" class="Box">

<div class="Corner-tl" style="background-image:url(layout/images/global/content/corner-tl.gif);"></div>
<div class="Corner-tr" style="background-image:url(layout/images/global/content/corner-tr.gif);"></div>
<div class="Border_1" style="background-image:url(layout/images/global/content/border-1.gif);"></div>
<div class="BorderTitleText" style="background-image:url(layout/images/global/content/title-background-green.gif);"></div>
<img id="ContentBoxHeadline" class="Title" src="layout/images/global/images/downloads.png" alt="Contentbox headline" />
<div class="Border_2">
    <div class="Border_3">
        <div class="BoxContent" style="background-image:url(layout/images/global/content/scroll.gif);">
            <div class="SmallBox">
    <div class="MessageContainer">
                    <div class="BoxFrameHorizontal" style="background-image:url(layout/images/global/images/box-frame-horizontal.gif);"></div>
                    <div class="BoxFrameEdgeLeftTop" style="background-image:url(layout/images/global/images/box-frame-edge.gif);"></div>
                    <div class="BoxFrameEdgeRightTop" style="background-image:url(layout/images/global/images/box-frame-edge.gif);"></div>
                    <div class="Message">
                        <div class="BoxFrameVerticalLeft" style="background-image:url(layout/images/global/images/box-frame-vertical.gif);"></div>
                        <div class="BoxFrameVerticalRight" style="background-image:url(layout/images/global/images/box-frame-vertical.gif);"></div>
    <h2>We tried to log you in, but...</h2>


    <?php
    header("HTTP/1.1 401 Not Found");
    echo output_errors($errors);
} ?></div><div class="BoxFrameHorizontal" style="background-image:url(layout/images/global/images/box-frame-horizontal.gif);"></div>
<div class="BoxFrameEdgeRightBottom" style="background-image:url(layout/images/global/images/box-frame-edge.gif);"></div>
<div class="BoxFrameEdgeLeftBottom" style="background-image:url(layout/images/global/images/box-frame-edge.gif);"></div>
</div>
</div>
<?php include 'layout/overall/footer.php'; ?>

Luego en la misma carpeta del uniserver www/engine/database/connect.php, abrimos ese archivo con notepad, borramos todo lo que tenga adentro y pegamos esto:
PHP:
<?php
$time = time();
if (!isset($version)) $version = '1.5_SVN';

if (!function_exists("elapsedTime")) {
    function elapsedTime($l_start = false, $l_time = false) {
        if ($l_start === false) global $l_start;
        if ($l_time === false) global $l_time;

        $l_time = explode(' ', microtime());
        $l_finish = $l_time[1] + $l_time[0];
        return round(($l_finish - $l_start), 4);
    }
}

// ALTER TABLE `znote_accounts` ADD `active_email` TINYINT(4) NOT NULL DEFAULT '0' AFTER `active`;

$install = "
<h2>Install:</h2>
<ol>
    <li>
        <p>
            Make sure you have imported TFS database. (OTdir/schema.sql OR OTdir/schemas/mysql.sql OR OTdir/forgottenserver.sql)
        </p>
    </li>
    <li>Import the <a href='/engine/database/znote_schema.sql'>Znote AAC schema</a> to a <b>TFS database in phpmyadmin</b>.</li>
    <li>
        <p>
            Edit config.php with correct mysql connection details.
        </p>
    </li>
</ol>
";

$connect = new mysqli($config['sqlHost'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);

if ($connect->connect_errno) {
    die("Failed to connect to MySQL: (" . $connect->connect_errno . ") " . $connect->connect_error . $install);
}

function mysql_znote_escape_string($escapestr) {
    global $connect;
    return mysqli_real_escape_string($connect, $escapestr);
}

// Select single row from database
function mysql_select_single($query) {
    global $connect;
    global $aacQueries;
    $aacQueries++;

    global $accQueriesData;
    $accQueriesData[] = "[" . elapsedTime() . "] " . $query;
    $result = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_single</b> (select single row from database)<br><br>".mysqli_error($connect));
    $row = mysqli_fetch_assoc($result);
    return !empty($row) ? $row : false;
}

// Selecting multiple rows from database.
function mysql_select_multi($query){
    global $connect;
    global $aacQueries;
    $aacQueries++;
    global $accQueriesData;
    $accQueriesData[] = "[" . elapsedTime() . "] " . $query;
    $array = array();
    $results = mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>select_multi</b> (select multiple rows from database)<br><br>".mysqli_error($connect));
    while($row = mysqli_fetch_assoc($results)) {
        $array[] = $row;
    }
    return !empty($array) ? $array : false;
}

//////
// Query database without expecting returned results

// - mysql update
function mysql_update($query){ voidQuery($query); }
// mysql insert
function mysql_insert($query){ voidQuery($query); }
// mysql delete
function mysql_delete($query){ voidQuery($query); }
// Send a void query
function voidQuery($query) {
    global $connect;
    global $aacQueries;
    $aacQueries++;
    global $accQueriesData;
    $accQueriesData[] = "[" . elapsedTime() . "] " . $query;
    mysqli_query($connect,$query) or die(var_dump($query)."<br>(query - <font color='red'>SQL error</font>) <br>Type: <b>voidQuery</b> (voidQuery is used for update, insert or delete from database)<br><br>".mysqli_error($connect));
}
?>
Por último corremos la consola y ya nos tendría que dejar entrar. este procedimiento fue hecho con el servidor de hellgrave.
Hice todo y me sigue arrojando el mismo error :(
 

Damian1234

Miembro
LV
14
 
Awards
15
Creo que ya vi que pasa, desde que intento crear el usuario en PhpMyAdmin me dice esto:
dot.gif
#1045 - Acceso negado para usuario: 'root'@'localhost' (Usando clave: SI) CREATE USER 'Hellgrave'@'localhost' IDENTIFIED WITH mysql_native_password BY '***';GRANT ALL PRIVILEGES ON *.* TO 'Hellgrave'@'localhost' WITH GRANT OPTION;
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Creo que ya vi que pasa, desde que intento crear el usuario en PhpMyAdmin me dice esto:
dot.gif
#1045 - Acceso negado para usuario: 'root'@'localhost' (Usando clave: SI) CREATE USER 'Hellgrave'@'localhost' IDENTIFIED WITH mysql_native_password BY '***';GRANT ALL PRIVILEGES ON *.* TO 'Hellgrave'@'localhost' WITH GRANT OPTION;
Claro en este caso tienes que crear un usuario y no usar el root , dale derechos a la base de datos y listo.
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
El detalle es que al crear el usuario me arroja ese error inmediatamente
Vale , a veces entonces sólo es que no te da el GRANT , pero todos los demás derechos si, y en si para localhost es suficiente , y debería de funcionar.
 

Damian1234

Miembro
LV
14
 
Awards
15
Vale , a veces entonces sólo es que no te da el GRANT , pero todos los demás derechos si, y en si para localhost es suficiente , y debería de funcionar.
Ya intente de todo, al momento de poner lo de paypal en "true" me da el error de php cURL y me dice que el servidor esta en matenimiento y al momento de ponerlo en "false" me arroja el error de interal server error :/
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Perdon por el doble post, cambie de Web y pude entrar, no se que error tenga esa ZnoteACC
Te dejé la respuesta anteriormente, dije de descargarlo de nuevo y reemplazar el login.php y config.countries.php.

Encontré el error y lo fijé haciendo la instalación a alguien en su pc.

Aqui lo dije:
 

Damian1234

Miembro
LV
14
 
Awards
15
Te dejé la respuesta anteriormente, dije de descargarlo de nuevo y reemplazar el login.php y config.countries.php.

Encontré el error y lo fijé haciendo la instalación a alguien en su pc.

Aqui lo dije:
Disculpa amigo, descargue de nuevo la Web y reemplace ambos archivos pero me siguio arrojando el mismo error.
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Disculpa amigo, descargue de nuevo la Web y reemplace ambos archivos pero me siguio arrojando el mismo error.
Borra la web que tienes, pon la nueva y prueba, quizás un archivo distinto está mal.
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Ya intente de todo, al momento de poner lo de paypal en "true" me da el error de php cURL y me dice que el servidor esta en matenimiento y al momento de ponerlo en "false" me arroja el error de interal server error :/
El php curl tienes que entrar en el php.i i o phprpduction e quitar los dos puntillos delante de curl , ;extensión=curl para que quede en extensión=curl
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Utilizo UniserverZ deberia estar el archivo php_production pero no lo encuentro aun con el buscador
Busca php nada más veras el archivo.

Para la web es la znoteAAC hellgrave v5.5 para v6 verdad ? Checare en cuando pueda estoy fuera durante dos dias
 

Damian1234

Miembro
LV
14
 
Awards
15
Busca php nada más veras el archivo.

Para la web es la znoteAAC hellgrave v5.5 para v6 verdad ? Checare en cuando pueda estoy fuera durante dos dias
Ya encontre el archivo php_production quedo bien.

Si amigo de verdad que cambie todos los archivos, el tutorial de mantenimiento y nada, instale la Web de aqui :https://opengamescommunity.com/index.php?resources/tibiacom-theme.37/ y funciono! me dejo entrar al juego, hice tambien lo que me dijiste copie ese config.php para ver si con ese funcionaba la Web de Hellgrave y no, me siguio arrojando el mismo error
 

Alex

Miembro del equipo
Webdesigner
LV
58
 
Awards
38
Pues es la que descarga con el LAUNCHER
Vale, Puedes quedarte con el TibiaCOM no estas obligado a utilizar esa web, solo pasate el config.php de la web para el Tibia.COM porque dentro tiene las ciudades, corrigeré ese error.
 
Arriba