Ir para conteúdo
  • Cadastre-se

(Resolvido)Problemas no Website


Ir para solução Resolvido por Mask Ghoul,

Posts Recomendados

.Qual servidor ou website você utiliza como base? 

https://github.com/peonso/ZnoteOTHire

Qual o motivo deste tópico? 

Problema na criação de personagem

Está surgindo algum erro? Se sim coloque-o aqui. 

Citar

1string(722) "INSERT INTO `players`(`name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull_type`, `skull_time`, `rank_id`, `guildnick`, `lastlogout`, `direction`, `loss_experience`, `loss_mana`, `loss_skills`, `loss_items`, `online`, `balance`) VALUES ('Sorcin', '1', '260960', '8', '1', '185', '185', '4200', '68', '76', '78', '58', '128', '0', '35', '35', '0', '100', '2', '5', '5', '2', '', '470', '1', '0', '', '1', '0', '0', '0', '', '0', '0', '100', '100', '100', '10', '0', '0');"
(query - SQL error)
Type: voidQuery (voidQuery is used for update, insert or delete from database)

Incorrect integer value: '' for column 'lastip' at row 1

 

Você tem o código disponível? Se tiver publique-o aqui: 

<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php'; 

if (empty($_POST) === false) {
    // $_POST['']
    $required_fields = array('name', 'selected_town');
    foreach($_POST as $key=>$value) {
        if (empty($value) && in_array($key, $required_fields) === true) {
            $errors[] = 'You need to fill in all fields.';
            break 1;
        }
    }
    
    // check errors (= user exist, pass long enough
    if (empty($errors) === true) {
        if (!Token::isValid($_POST['token'])) {
            $errors[] = 'Token is invalid.';
        }
        $_POST['name'] = validate_name($_POST['name']);
        if ($_POST['name'] === false) {
            $errors[] = 'Your name can not contain more than 2 words.';
        } else {
            if (user_character_exist($_POST['name']) !== false) {
                $errors[] = 'Sorry, that character name already exist.';
            }
            if (!preg_match("/^[a-zA-Z_ ]+$/", $_POST['name'])) {
                $errors[] = 'Your name may only contain a-z, A-Z and spaces.';
            }
            if (strlen($_POST['name']) < $config['minL'] || strlen($_POST['name']) > $config['maxL']) {
                $errors[] = 'Your character name must be between 4 - 20 characters long.';
            }
            // name restriction
            $resname = explode(" ", $_POST['name']);
            foreach($resname as $res) {
                if(in_array(strtolower($res), $config['invalidNameTags'])) {
                    $errors[] = 'Your username contains a restricted word.';
                }
                else if(strlen($res) == 1) {
                    $errors[] = 'Too short words in your name.';
                }
            }
            // Validate vocation id
            if (!in_array((int)$_POST['selected_vocation'], $config['available_vocations'])) {
                $errors[] = 'Permission Denied. Wrong vocation.';
            }
            // Validate town id
            if (!in_array((int)$_POST['selected_town'], $config['available_towns'])) {
                $errors[] = 'Permission Denied. Wrong town.';
            }
            // Validate gender id
            if (!in_array((int)$_POST['selected_gender'], array(0, 1))) {
                $errors[] = 'Permission Denied. Wrong gender.';
            }
            if (vocation_id_to_name($_POST['selected_vocation']) === false) {
                $errors[] = 'Failed to recognize that vocation, does it exist?';
            }
            if (town_id_to_name($_POST['selected_town']) === false) {
                $errors[] = 'Failed to recognize that town, does it exist?';
            }
            if (gender_exist($_POST['selected_gender']) === false) {
                $errors[] = 'Failed to recognize that gender, does it exist?';
            }
            // Char count
            $char_count = user_character_list_count($session_user_id);
            if ($char_count >= $config['max_characters']) {
                $errors[] = 'Your account is not allowed to have more than '. $config['max_characters'] .' characters.';
            }
            if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
                $errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
            }
        }
    }
}
?>

<h1>Create Character</h1>
<?php
if (isset($_GET['success']) && empty($_GET['success'])) {
    echo 'Congratulations! Your character has been created. See you in-game!';
} else {
    if (empty($_POST) === false && empty($errors) === true) {
        if ($config['log_ip']) {
            znote_visitor_insert_detailed_data(2);
        }
        //Register
        $character_data = array(
            'name'        =>    format_character_name($_POST['name']),
            'account_id'=>    $session_user_id,
            'vocation'    =>    $_POST['selected_vocation'],
            'town_id'    =>    $_POST['selected_town'],
            'sex'        =>    $_POST['selected_gender'],
            'lastip'    =>    ip2long(getIP()),
            'created'    =>    time()
        );
        
        user_create_character($character_data);
        header('Location: createcharacter.php?success');
        exit();
        //End register
        
    } else if (empty($errors) === false){
        echo '<font color="red"><b>';
        echo output_errors($errors);
        echo '</b></font>';
    }
    ?>
    <form action="" method="post">
        <ul>
            <li>
                Name:<br>
                <input type="text" name="name">
            </li>
            <li>
                <!-- Available vocations to select from when creating character -->
                Vocation:<br>
                <select name="selected_vocation">
                <?php foreach ($config['available_vocations'] as $id) { ?>
                <option value="<?php echo $id; ?>"><?php echo vocation_id_to_name($id); ?></option>
                <?php } ?>
                </select>
            </li>
            <li>
                <!-- Available genders to select from when creating character -->
                Gender:<br>
                <select name="selected_gender">
                <option value="1">Male</option>
                <option value="0">Female</option>
                </select>
            </li>
            <li>
                <!-- Available towns to select from when creating character -->
                Town:<br>
                <select name="selected_town">
                <?php foreach ($config['available_towns'] as $tid) { ?>
                <option value="<?php echo $tid; ?>"><?php echo town_id_to_name($tid); ?></option>
                <?php } ?>
                </select>
            </li>
            <?php
                /* Form file */
                Token::create();
            ?>
            <li>
                <input type="submit" value="Create Character">
            </li>
        </ul>
    </form>
    <?php
}
include 'layout/overall/footer.php'; ?>

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

image.thumb.png.fe3682e73a86831f9e3427ca8ed24d33.png

Link para o post
Compartilhar em outros sites
  • Solução
1 hora atrás, matho disse:

.Qual servidor ou website você utiliza como base? 

https://github.com/peonso/ZnoteOTHire

Qual o motivo deste tópico? 

Problema na criação de personagem

Está surgindo algum erro? Se sim coloque-o aqui. 

 

Você tem o código disponível? Se tiver publique-o aqui: 

<?php require_once 'engine/init.php';
protect_page();
include 'layout/overall/header.php'; 

if (empty($_POST) === false) {
    // $_POST['']
    $required_fields = array('name', 'selected_town');
    foreach($_POST as $key=>$value) {
        if (empty($value) && in_array($key, $required_fields) === true) {
            $errors[] = 'You need to fill in all fields.';
            break 1;
        }
    }
    
    // check errors (= user exist, pass long enough
    if (empty($errors) === true) {
        if (!Token::isValid($_POST['token'])) {
            $errors[] = 'Token is invalid.';
        }
        $_POST['name'] = validate_name($_POST['name']);
        if ($_POST['name'] === false) {
            $errors[] = 'Your name can not contain more than 2 words.';
        } else {
            if (user_character_exist($_POST['name']) !== false) {
                $errors[] = 'Sorry, that character name already exist.';
            }
            if (!preg_match("/^[a-zA-Z_ ]+$/", $_POST['name'])) {
                $errors[] = 'Your name may only contain a-z, A-Z and spaces.';
            }
            if (strlen($_POST['name']) < $config['minL'] || strlen($_POST['name']) > $config['maxL']) {
                $errors[] = 'Your character name must be between 4 - 20 characters long.';
            }
            // name restriction
            $resname = explode(" ", $_POST['name']);
            foreach($resname as $res) {
                if(in_array(strtolower($res), $config['invalidNameTags'])) {
                    $errors[] = 'Your username contains a restricted word.';
                }
                else if(strlen($res) == 1) {
                    $errors[] = 'Too short words in your name.';
                }
            }
            // Validate vocation id
            if (!in_array((int)$_POST['selected_vocation'], $config['available_vocations'])) {
                $errors[] = 'Permission Denied. Wrong vocation.';
            }
            // Validate town id
            if (!in_array((int)$_POST['selected_town'], $config['available_towns'])) {
                $errors[] = 'Permission Denied. Wrong town.';
            }
            // Validate gender id
            if (!in_array((int)$_POST['selected_gender'], array(0, 1))) {
                $errors[] = 'Permission Denied. Wrong gender.';
            }
            if (vocation_id_to_name($_POST['selected_vocation']) === false) {
                $errors[] = 'Failed to recognize that vocation, does it exist?';
            }
            if (town_id_to_name($_POST['selected_town']) === false) {
                $errors[] = 'Failed to recognize that town, does it exist?';
            }
            if (gender_exist($_POST['selected_gender']) === false) {
                $errors[] = 'Failed to recognize that gender, does it exist?';
            }
            // Char count
            $char_count = user_character_list_count($session_user_id);
            if ($char_count >= $config['max_characters']) {
                $errors[] = 'Your account is not allowed to have more than '. $config['max_characters'] .' characters.';
            }
            if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
                $errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
            }
        }
    }
}
?>

<h1>Create Character</h1>
<?php
if (isset($_GET['success']) && empty($_GET['success'])) {
    echo 'Congratulations! Your character has been created. See you in-game!';
} else {
    if (empty($_POST) === false && empty($errors) === true) {
        if ($config['log_ip']) {
            znote_visitor_insert_detailed_data(2);
        }
        //Register
        $character_data = array(
            'name'        =>    format_character_name($_POST['name']),
            'account_id'=>    $session_user_id,
            'vocation'    =>    $_POST['selected_vocation'],
            'town_id'    =>    $_POST['selected_town'],
            'sex'        =>    $_POST['selected_gender'],
            'lastip'    =>    ip2long(getIP()),
            'created'    =>    time()
        );
        
        user_create_character($character_data);
        header('Location: createcharacter.php?success');
        exit();
        //End register
        
    } else if (empty($errors) === false){
        echo '<font color="red"><b>';
        echo output_errors($errors);
        echo '</b></font>';
    }
    ?>
    <form action="" method="post">
        <ul>
            <li>
                Name:<br>
                <input type="text" name="name">
            </li>
            <li>
                <!-- Available vocations to select from when creating character -->
                Vocation:<br>
                <select name="selected_vocation">
                <?php foreach ($config['available_vocations'] as $id) { ?>
                <option value="<?php echo $id; ?>"><?php echo vocation_id_to_name($id); ?></option>
                <?php } ?>
                </select>
            </li>
            <li>
                <!-- Available genders to select from when creating character -->
                Gender:<br>
                <select name="selected_gender">
                <option value="1">Male</option>
                <option value="0">Female</option>
                </select>
            </li>
            <li>
                <!-- Available towns to select from when creating character -->
                Town:<br>
                <select name="selected_town">
                <?php foreach ($config['available_towns'] as $tid) { ?>
                <option value="<?php echo $tid; ?>"><?php echo town_id_to_name($tid); ?></option>
                <?php } ?>
                </select>
            </li>
            <?php
                /* Form file */
                Token::create();
            ?>
            <li>
                <input type="submit" value="Create Character">
            </li>
        </ul>
    </form>
    <?php
}
include 'layout/overall/footer.php'; ?>

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

image.thumb.png.fe3682e73a86831f9e3427ca8ed24d33.png

Execute esta consulta em SQL: https://github.com/Znote/ZnoteAAC/blob/master/engine/database/znote_schema.sql

 

Repositório ZnoteAAC original baixe: https://github.com/Znote/ZnoteAAC
tenta ae

Editado por Mask Ghoul (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo