Ir para conteúdo

Pesquisar na Comunidade

Mostrando resultados para as tags ''php''.

  • Pesquisar por Tags

    Digite tags separadas por vírgulas
  • Pesquisar por Autor

Tipo de Conteúdo


Todas as áreas do Fórum

  • Q&A Desenvolvimento
    • Perguntas e respostas rápidas
  • Desenvolvimento Web
    • Desenvolvimento frontend
    • Javascript
    • PHP
    • Ruby
    • Python
    • Java
    • .NET
    • Docker, Kubernets e outros ambientes
    • Desenvolvimento com Wordpress
    • Desenvolvimento de apps
    • Desenvolvimento ágil
    • Desenvolvimento de Games
    • Banco de Dados
    • Design e UX
    • Algoritmos & Outras Tecnologias
  • Entretenimento e uso pessoal
    • Segurança & Malwares
    • Geral
    • Boteco iMasters

Encontrar resultados em...

Encontrar resultados que...


Data de Criação

  • Início

    FIM


Data de Atualização

  • Início

    FIM


Filtrar pelo número de...

Data de Registro

  • Início

    FIM


Grupo


Google+


Hangouts


Skype


Twitter


deviantART


Github


Flickr


LinkedIn


Pinterest


Facebook


Site Pessoal


Localização


Interesses

Encontrado 1414 registros

  1. helkton

    criar array com itens adicionais de cada ITEM

    galera preciso criar um array que pegue os itens adicionais de cada ITEM escolhido... vou tentar explicar... tenho uma pagina com as categorias do CARDÁPIO LANCHES - AÇAI - SALGADOS - PIZZAS CADA categoria contem seus devidos itens tipo... LANCHES 1-xFrango 2-xSalada 3-xBacon AÇAI 1-Copo 300ml 2-Copo 500ml 3-Copo 700ml até esta funcionando, cada item que o usuário escolher, salvo em uma S_SESSION['itens'] agora vamos supor que, esses itens tenham adicionais, já criei um <?php if(){}?> e ele já faz essa verificação, então se o item LANCHES 1=XFRANGO NÃO conter adicional para ser escolhido ele simplesmente irá ser adicionado no carrinho, AGORA se o item tiver adicional para ser escolhido, irá abrir um MODAL com os adicionais disponíveis para o ITEM Agora digamos que o AÇAÍ) 1-COPO 300ML tenha adicional eu abro o meu modal com os seguintes adicionais: FRUTAS 1-Morango 1,00 2-Banana 1,00 3-Uva 1,00 COMPLEMENTOS 1-Ninho 1,00 2-Coco Ralado 1,00 3-Castanha 1,00 COBERTURA 1-Chocolate 1,00 2-Leite condensado 1,00 3-Morango 1,00 ADICIONAIS 1-Nutella 1,00 2-Bis 1,00 3-KitKat 1,00 então como pego esses adicionais e salvo em cada ITEM escolhido pelo usuário e se possivel somar esses adicionais que tenha valores também
  2. Chris Martin

    Relacionamentos Laravel

    Pessoal, estou com um problema com relacionamentos no laravel. (Inclusive pode ser até falta de atenção minha), mas quebrei a cabeça demais e não consegui; Tenho as tabelas 'arquiteto' e 'cliente' e um arquiteto tem vários clientes, só que não consegui fazer o relacionamento aparecer na tabela 'cliente' tenho o campo `arquiteto_id' que referencia o 'id' da tabela 'arquitetos', só que quando fiz a relação na model Arquiteto ela não está aparecendo class Arquiteto extends Model{ protected $fillable = [...]; public function clientes() { return $this->hasMany('App\Cliente'); } }
  3. gersonab

    update select option com dados do banco

    bom dia. estou com um problema aqui, quando vou fazer update de uma página com dados vindos do banco os select option mostra os dados corretamente porém os value capturados não estão corretos, um exemplo, se for de cidades vem no value somente o primeiro nome da cidade enquanto na exibição do nome vem completo, logo, quando faço o update grava somente o primeiro nome, pois esta se dividindo e criando campos. <select class="form-control" name="cidade"> <option value="">-- Selecionar --</option> <?php $curc4 = $pdo->query("SELECT * FROM comarca ORDER BY comarc asc"); while ($lic4 = $curc4->fetch(PDO::FETCH_ASSOC)) { echo "<option value=".$lic4['comarc']." ".($cidade == $lic4['comarc'] ? "selected":"")." >".$lic4['comarc']."</option>"; } ?> </select> como é mostrado no console: <option value="ANGRA" dos="" reis="">ANGRA DOS REIS</option> desde já agradeço ajuda
  4. vmmh

    consumindo webservice com soapclient

    Alguma alma caridosa que me possa ajudar ? há dias que ando com este problema e não consigo resolver. Ficaria eternamente grato se alguém pudesse ajudar o codigo abaixo em localhost funciona na perfeição , mas em produção , no lado do servidor , nada... HTTP error 500. o pedido que estou a fazer está noutro dominio com porta 81 e no meu dominio uso certificado de segurança. Será por aí? de qualquer forma o wsdl está aqui: $client = new SoapClient('https://dekrainspecoes.pt/acp/PROD_CustomUI_ACP_Member_Validation_WS.WSDL'); $result = $client->QueryByNumCartao(array('N_Cartao' => "705684011673122085")); if (!empty($result->QueryByNumCartao_Output->Cartao_Ativo)) { echo 'The userId : '.$result->QueryByNumCartao_Output ->Pessoa_ID; } $JSON = json_encode($result);
  5. unset

    Como ordenar strings que começam com números?

    Olá, alguém poderia me dar uma luz. Como faço para ordenar strings que começam com números, exemplo Tenho uma lista de artigos e os nomes são como abaixo. 1 - NOME DO ARQUIVO 1 2 - NOME DO ARQUIVO 2 etc.... 10 - NOME DO ARQUIVO 10 Não consegui ordenar no SELECT com o ORDER BY nome DESC pq o número 10 fica abaixo do 1 Como fazer assim, 1,2,3,4,5....... 10,11,12 .... 100, 101,102 etc...
  6. Rodrigo5468

    Mostrar Resultados sem Repetir Dados

    Olá a todos(as), boa tarde! Tenho uma Query e um pequeno código em PHP para mostrar os resultados em uma tabela, mas estão repetindo os resultados da Query. Gostaria de uma solução, ou uma gambiarra para isso. Query SELECT DISTINCT b.ID AS "ID", b.Character AS "Personagem", b.Money AS "DinMao", b.BankMoney AS "DinBanco", b.Savings2 AS "DinPoupa", c.houseOwner AS "IDono", SUM(c.houseMoney) AS "DinCasa" FROM characters b INNER JOIN houses c ON (b.ID = c.houseOwner) ORDER BY ((b.Money+b.BankMoney+b.Savings2+c.houseMoney)) DESC LIMIT 0, 1000 PHP if(mysqli_num_rows($q) > 0) { while($r = $q->fetch_assoc()) { //Código da Tabela } } Observação: Quando eu removo a seguinte parte da minha Query que é: SUM(c.houseMoney) AS "DinCasa" e deixo assim: c.houseMoney AS "DinCasa" Os dados da minha tabela repetem, não sei o motivo e/ou a circunstância disso. Mas peço a ajuda de vocês para solucionar. Vale ressaltar que (ID e houseOwner) tem os mesmos valores, só o valor da casa que recebe o valor do ID, e ele pode ter quantas casa ele quiser, e se ele tiver cinco casas, mostrará o resultado cinco resultados na minha tabela, como posso resolver isso? Meu muito obrigado desde já.
  7. guilhermefdavid

    Quais extensões ativar para funções PHP funcionarem?

    Olá, tenho uma aplicação PHP com algumas funções que não estão funcionando na hospedagem. Esta aplicação utiliza apenas conexão com banco de dados -> mysql_connect, mysql_select_db, entre outras de MYSQL. Alguma ideia de qual extensão, dentre as existentes na imagem anexa deveria(m) estar ativada(s)? Um abraço!
  8. jganjos

    Listar determinara array com PHP

    Boa tarde senhores. Estou gerando esta array com o PHP Array ( [header] => Array ( [ico] => fas fa-building [tit] => Empresa [lab] => Cadastro da Empresa ) [forms] => Array ( [RAZAO] => Array ( [tit] => Razão Social ) [NFANTASIA] => Array ( [tit] => Nome Fantasia [lin] => 1 [col] => 10 ) [STATUS] => Array ( [tit] => Status [typ] => switch [val] => 1,0 [lin] => 1 [col] => 2 ) [INSCRICAO] => Array ( [tit] => Inscrição [lin] => 2 [col] => 4 ) [IE] => Array ( [tit] => Insc. Estadual [lin] => 2 [col] => 4 ) [IM] => Array ( [tit] => Insc. Municipal [lin] => 2 [col] => 4 ) [CEP] => Array ( [tit] => CEP [lin] => 3 [col] => 4 [btn] => search ) [TIPO_END] => Array ( [typ] => hidden ) [ENDERECO] => Array ( [tit] => Endereço [lin] => 4 [col] => 9 ) [NUM_END] => Array ( [tit] => Número [lin] => 4 [col] => 3 ) [BAIRRO] => Array ( [tit] => Bairro [lin] => 5 [col] => 6 ) [COMPL] => Array ( [tit] => Complemento [lin] => 5 [col] => 6 ) [MUNICIPIO] => Array ( [tit] => Município [lin] => 6 [col] => 9 ) [UF] => Array ( [tit] => Estado [typ] => list [tab] => estados [lin] => 6 [col] => 3 ) [TEL1] => Array ( [tit] => Telefone [msk] => phone [lin] => 7 [col] => 6 ) [TEL2] => Array ( [tit] => Telefone [msk] => phone [lin] => 7 [col] => 6 ) [EMAIL] => Array ( [tit] => e-mail [typ] => email [lin] => 8 [col] => 6 ) [SITE] => Array ( [tit] => Site da empresa [typ] => website [lin] => 8 [col] => 6 ) ) ) Preciso listar os valores da Array *FORMS* e seus respectivos filhos mas não estou conseguindo utilizando o foreach. Alguém teria uma dica?
  9. Rafaellaranjo

    Alto consumo de CPU

    Estou sofrendo a um tempo com consumo alto de CPU em meu servidor na maioria dos casos em virtude do MYSQL, trabalho com PHP e APACHE e MYSQL. Realizei inúmeras tentativas para acabar com o alto consumo porém todas fracassadas. O evento costuma ocorrer sempre nos mesmos horários, parte da manhã por volta de 9:30/11:00 e parte da tarde entre 14:00/16:00. Meu servidor possui hardware suficiente para suportar, porem acredito que esteja mal configurado. Estou encaminhando alguns processos que observo estar executando em excesso obtidos através do ps aux. dovecot/pop3-login dovecot/imap-login dovecot/lmtp -L php-fpm: pool app (o que mais aparece) Ps: utilizo um servidor CENTOS 7
  10. dimoreira

    Pegar dados da Bet365

    Boa noite programadores, estou a procura de um profissional que desenvolva um site simples, que tem apenas que me mostrar os resultados em tempo real da pagina de resultados da bet 365. Mas especificamente do futebol virtual. Vou mandar em anexo uma foto pra ter como base. O modelo mais simples possivel é somente para acompanhar os resultados em tempo real sem ter q esta acessando o site da bet.
  11. wendelimoveis

    Página em Branco no PHP

    Quando eu abro localhost vejo a pagina do xampp funcionando, mas nada é exibido no localhost/sistema. Alguem pode ajudar? Ela fica somente uma página em branco. Alguém tem uma ideia de onde eu estou errando?
  12. manigold

    Leitura de Arquivo XML pequeno problema

    Estou com um pequeno problema nessa parte: $monsters = simplexml_load_file($otdir . '/data/monster/monsters.xml') or die('<b>Could not load monsters!</b>'); foreach($monsters->monster as $monster) { $loot = simplexml_load_file($otdir . '/data/monster/' . $monster['file']); if($loot) { if($item = $loot->loot->item){ A pagina mostra a lista de items corretamente mas se eu tenho um item dentro de outro item ,como nesse exemplo: <loot> <item id="2148" countmax="100" chance="33750" /> <item id="2148" countmax="100" chance="33750" /> <item id="2672" countmax="5" chance="80000" /> <item id="7399" chance="80" /> <item id="2392" chance="1428" /> <item id="2033" chance="3190" /> <item id="2547" countmax="7" chance="6700" /> <item id="5948" chance="3040" /> <item id="1987" chance="100000"> <!-- bag --> O PROBLEMA É NESSA PARTE <item id="5882" chance="5920" /> <item id="2498" chance="888" /> <item id="7378" countmax="3" chance="8800" /> <item id="2146" chance="5300" /> <item id="2414" chance="1500"/> <item id="2528" chance="2333" /> <item id="7402" chance="2000" /> <item id="2492" chance="730" /> </item> </loot> Os items dentro do item com id 1987 não são mostrados . Me desculpem se a explicação não esta muito boa , não entendo nada de php e xml ,eu agradeço se alguem puder me ajudar.
  13. edison.silva

    Converter notação ciêntifica para numero

    pessoal, alguém sabe como converte o valor 9,8132E+12 para um inteiro normal com php? este valor é um CNPJ gostaria de converter para o valor normal e ele esta vindo como notação cientifica.. tentei: sprintf( '%.0f', 9.8132E+12 ) resultado: 9813200000000 preencheu com zeros
  14. eduardo_barros

    Laravel SQL Server

    Boa tarde, Possuo uma aplicação rodando em Laravel com Db Mysql. Porem um cliente solicitou que o nosso sistema ficasse gravando informações no banco de dados SQL deles e vice e versa, só que o sistema deles não tem API, nesse caso vamos executar as queries do banco banco deles do nosso lado lendo e escrevendo, como funciona essa multiconexão de bancos dentro do laravel?
  15. Marcones Borges

    Filtrar Variável em um select

    Olá, bom dia, estou tendo dificuldade em uma filtragem, quando passo o parâmetro para o select em forma de variável ele não exibe resultados. Segue o código: $usuario='gerente'; function montaSelect() { $sql = "SELECT * FROM membros WHERE user='".$usuario."' "; $query = mysql_query( $sql ); if( mysql_num_rows( $query ) > 0 ) { while( $dados = mysql_fetch_assoc( $query ) ) { $opt .= '<option value="'.$dados['nome'].'">'.$dados['nome'].'</option>'; } } else $opt = '<option value="0">Nenhum Membro cadastrado</option>'; return $opt; } Quando substituo a variável pelo nome usuário gerente, ele lista normal, mais na variável não da certo. já tentei user='{$usuario}' , user='$usuario' , user=$usuario}, nenhuma forma funciona... Alguém pode me ajudar..
  16. user32

    problema com action

    Boa tarde pessoal, acredito que estou com o problema e a solução no post só que nao sei exatamente aonde alterar o codigo. Um site de servidor de games de um cliente esta com um problema na aba forum. é um forum simples para questoes relacionadas ao game. Irei anexar alguns prints para facilitar o entendimento e o codigo. Resumindo: O problema é que o forum tem algumas boards (News, Wars, Quests, Pictures e Bug reports), suponhamos que dessas boards Pictures tem 4 posts e Quests 1 post. Se o primeito post do forum for em Pictures, quando eu tentar abrir o post de Quests ele ira me redirecionar para Pictures, e dentro de pictures terá todos os posts de todas as boards. Se eu tentar excluir algum topico de qualquer board, todos os topicos são excluidos. Acredito que o problema esteja no criação do ID do post na database, todos estão sendo gerados como ID 0. Imagino que a função new_post não está trabalhando corretamente. se alguem puder me ajudar eu fico muito agradecido mesmo!! to quebrando a cabeça aqui a um tempo, só falta isso pra terminar. PRINTS E EXPLICAÇÃO: print de todos as boards print da board war (observe que existe apenas um post nessa board) print apos selecionar post da board war (repare que fui redirecionado para a board Report Bug que foi a que eu criei o primeiro post do forum como expliquei acima no resumo) print do banco de dados (todos os IDs são 0) <?php if(!defined('INITIALIZED')) exit; // CONFIG $level_limit = 30; // minimum 1 character with 30 lvl on account to post $post_interval = 20; // 20 seconds between posts $group_not_blocked = $config['site']['access_admin_panel']; // group id of player that can always post, remove post, remove threads $posts_per_page = 20; $threads_per_page = 20; // SECTION WITH ID 1 IS FOR "NEWS", ONLY ADMINS CAN CREATE NEW THREAD IN IT $sections = array(1 => 'News', 2 => 'Wars', 3 => 'Quests', 4 => 'Pictures', 5 => 'Bug Report'); $sections_desc = array(1 => 'Here you can comment news.', 2 => 'Feel free to tell what you think about your enemy.', 3 => 'Talk with others about quests you made and how to make them.', 4 => 'Show others your best photos from server!', 5 => 'Report bugs on website and in-game here.'); // END function canPost($account) { if($account->isLoaded()) if(!$account->isBanned()) { $SQL = $GLOBALS['SQL']; $level_limit = $GLOBALS['level_limit']; $player = $SQL->query("SELECT " . $SQL->fieldName('level') . " FROM " . $SQL->tableName('players') . " WHERE " . $SQL->fieldName('account_id') . " = ".$SQL->quote($account->getId())." ORDER BY " . $SQL->fieldName('level') . " DESC")->fetch(); if($player['level'] >= $level_limit) return true; } return false; } function replaceSmile($text, $smile) { $smileys = array(';D' => 1, ':D' => 1, ':cool:' => 2, ';cool;' => 2, ':ekk:' => 3, ';ekk;' => 3, ';o' => 4, ';O' => 4, ':o' => 4, ':O' => 4, ':(' => 5, ';(' => 5, ':mad:' => 6, ';mad;' => 6, ';rolleyes;' => 7, ':rolleyes:' => 7, ':)' => 8, ';d' => 9, ':d' => 9, ';)' => 10); if($smile == 1) return $text; else { foreach($smileys as $search => $replace) $text = str_replace($search, '<img src="images/forum/smile/'.$replace.'.gif" />', $text); return $text; } } function replaceAll($text, $smile) { $rows = 0; while(stripos($text, '[code]') !== false && stripos($text, '[/code]') !== false && stripos($text, '[code]') < stripos($text, '[/code]')) { $code = substr($text, stripos($text, '[code]')+6, stripos($text, '[/code]') - stripos($text, '[code]') - 6); if(!is_int($rows / 2)) { $bgcolor = 'ABED25'; } else { $bgcolor = '23ED25'; } $rows++; $text = str_ireplace('[code]'.$code.'[/code]', '<i>Code:</i><br /><table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #CCCCCC; border-width: 2px"><tr><td>'.$code.'</td></tr></table>', $text); } $rows = 0; while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false && stripos($text, '[quote]') < stripos($text, '[/quote]')) { $quote = substr($text, stripos($text, '[quote]')+7, stripos($text, '[/quote]') - stripos($text, '[quote]') - 7); if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++; $text = str_ireplace('[quote]'.$quote.'[/quote]', '<table cellpadding="0" style="background-color: #'.$bgcolor.'; width: 480px; border-style: dotted; border-color: #007900; border-width: 2px"><tr><td>'.$quote.'</td></tr></table>', $text); } $rows = 0; while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false && stripos($text, '[url]') < stripos($text, '[/url]')) { $url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5); $text = str_ireplace('[url]'.$url.'[/url]', '<a href="'.$url.'" target="_blank">'.$url.'</a>', $text); } while(stripos($text, '[player]') !== false && stripos($text, '[/player]') !== false && stripos($text, '[player]') < stripos($text, '[/player]')) { $player = substr($text, stripos($text, '[player]')+8, stripos($text, '[/player]') - stripos($text, '[player]') - 8); $text = str_ireplace('[player]'.$player.'[/player]', '<a href="?subtopic=characters&name='.urlencode($player).'">'.$player.'</a>', $text); } while(stripos($text, '[img]') !== false && stripos($text, '[/img]') !== false && stripos($text, '[img]') < stripos($text, '[/img]')) { $img = substr($text, stripos($text, '[img]')+5, stripos($text, '[/img]') - stripos($text, '[img]') - 5); $text = str_ireplace('[img]'.$img.'[/img]', '<img src="'.$img.'">', $text); } while(stripos($text, '[b]') !== false && stripos($text, '[/b]') !== false && stripos($text, '[b]') < stripos($text, '[/b]')) { $b = substr($text, stripos($text, '[b]')+3, stripos($text, '[/b]') - stripos($text, '[b]') - 3); $text = str_ireplace('[b]'.$b.'[/b]', '<b>'.$b.'</b>', $text); } while(stripos($text, '[i]') !== false && stripos($text, '[/i]') !== false && stripos($text, '[i]') < stripos($text, '[/i]')) { $i = substr($text, stripos($text, '[i]')+3, stripos($text, '[/i]') - stripos($text, '[i]') - 3); $text = str_ireplace('[i]'.$i.'[/i]', '<i>'.$i.'</i>', $text); } while(stripos($text, '[u]') !== false && stripos($text, '[/u]') !== false && stripos($text, '[u]') < stripos($text, '[/u]')) { $u = substr($text, stripos($text, '[u]')+3, stripos($text, '[/u]') - stripos($text, '[u]') - 3); $text = str_ireplace('[u]'.$u.'[/u]', '<u>'.$u.'</u>', $text); } return replaceSmile($text, $smile); } function removeBBCode($text) { while(stripos($text, '[code]') !== false && stripos($text, '[/code]') !== false ) { $code = substr($text, stripos($text, '[code]')+6, stripos($text, '[/code]') - stripos($text, '[code]') - 6); $text = str_ireplace('[code]'.$code.'[/code]', $code, $text); } while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false ) { $quote = substr($text, stripos($text, '[quote]')+7, stripos($text, '[/quote]') - stripos($text, '[quote]') - 7); $text = str_ireplace('[quote]'.$quote.'[/quote]', $quote, $text); } while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false ) { $url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5); $text = str_ireplace('[url]'.$url.'[/url]', $url, $text); } while(stripos($text, '[player]') !== false && stripos($text, '[/player]') !== false ) { $player = substr($text, stripos($text, '[player]')+8, stripos($text, '[/player]') - stripos($text, '[player]') - 8); $text = str_ireplace('[player]'.$player.'[/player]', $player, $text); } while(stripos($text, '[img]') !== false && stripos($text, '[/img]') !== false ) { $img = substr($text, stripos($text, '[img]')+5, stripos($text, '[/img]') - stripos($text, '[img]') - 5); $text = str_ireplace('[img]'.$img.'[/img]', $img, $text); } while(stripos($text, '[b]') !== false && stripos($text, '[/b]') !== false ) { $b = substr($text, stripos($text, '[b]')+3, stripos($text, '[/b]') - stripos($text, '[b]') - 3); $text = str_ireplace('[b]'.$b.'[/b]', $b, $text); } while(stripos($text, '[i]') !== false && stripos($text, '[/i]') !== false ) { $i = substr($text, stripos($text, '[i]')+3, stripos($text, '[/i]') - stripos($text, '[i]') - 3); $text = str_ireplace('[i]'.$i.'[/i]', $i, $text); } while(stripos($text, '[u]') !== false && stripos($text, '[/u]') !== false ) { $u = substr($text, stripos($text, '[u]')+3, stripos($text, '[/u]') - stripos($text, '[u]') - 3); $text = str_ireplace('[u]'.$u.'[/u]', $u, $text); } return $text; } function codeLower($text) { return str_ireplace(array('[b]', '[i]', '[u]', '[/u][/i][/b][i][u]', '[/u][/i][u]', '[/u]', '[url]', '[player]', '[img]', '[code]', '[quote]', '[/quote][/code][/url][code][quote]', '[/player]', '[/img]', '[/quote][/code][quote]', '[/quote]'), array('[b]', '[i]', '[u]', '[/u][/i][/b][i][u]', '[/u][/i][u]', '[/u]', '[url]', '[player]', '[img]', '[code]', '[quote]', '[/quote][/code][/url][code][quote]', '[/player]', '[/img]', '[/quote][/code][quote]', '[/quote]'), $text); } function showPost($topic, $text, $smile) { $text = nl2br($text); $post = ''; if(!empty($topic)) $post .= '<b>'.replaceSmile($topic, $smile).'</b><hr />'; $post .= replaceAll($text, $smile); return $post; } if(!$logged) $main_content .= 'You are not logged in. <a href="?subtopic=accountmanagement">Log in</a> to post on the forum.<br /><br />'; if($action == '') { $main_content .= '<b>Boards</b>'; $main_content .= '<table width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td><font color="white" size="1"><b>Board</b></font></td><td><font color="white" size="1"><b>Posts</b></font></td><td><font color="white" size="1"><b>Threads</b></font></td><td align="center"><font color="white" size="1"><b>Last Post</b></font></td></tr>'; $info = $SQL->query("SELECT " . $SQL->fieldName('section') . ", COUNT(" . $SQL->fieldName('id') . ") AS 'threads', SUM(" . $SQL->fieldName('replies') . ") AS 'replies' FROM " . $SQL->tableName('z_forum') . " WHERE " . $SQL->fieldName('first_post') . " = " . $SQL->fieldName('id') . " GROUP BY " . $SQL->fieldName('section') . "")->fetchAll(); foreach($info as $data) $counters[$data['section']] = array('threads' => $data['threads'], 'posts' => $data['replies'] + $data['threads']); foreach($sections as $id => $section) { $last_post = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . " FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('section') . " = ".(int) $id." AND " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " ORDER BY " . $SQL->fieldName('post_date') . " DESC LIMIT 1")->fetch(); if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<tr bgcolor="'.$bgcolor.'"><td><a href="?subtopic=forum&action=show_board&id='.$id.'">'.$section.'</a><br /><small>'.$sections_desc[$id].'</small></td><td>'.(int) $counters[$id]['posts'].'</td><td>'.(int) $counters[$id]['threads'].'</td><td>'; if(isset($last_post['name'])) $main_content .= date('d.m.y H:i:s', $last_post['post_date']).'<br />by <a href="?subtopic=characters&name='.urlencode($last_post['name']).'">'.$last_post['name'].'</a>'; else $main_content .= 'No posts'; $main_content .= '</td></tr>'; } $main_content .= '</table>'; } if($action == 'show_board') { $section_id = (int) $_REQUEST['id']; $page = (int) $_REQUEST['page']; $threads_count = $SQL->query("SELECT COUNT(" . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . ") AS threads_count FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('section') . " = ".(int) $section_id." AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . "")->fetch(); for($i = 0; $i < $threads_count['threads_count'] / $threads_per_page; $i++) { if($i != $page) $links_to_pages .= '<a href="?subtopic=forum&action=show_board&id='.$section_id.'&page='.$i.'">'.($i + 1).'</a> '; else $links_to_pages .= '<b>'.($i + 1).' </b>'; } $main_content .= '<a href="?subtopic=forum">Boards</a> >> <b>'.$sections[$section_id].'</b><br /><br /><a href="?subtopic=forum&action=new_topic&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a><br /><br />Page: '.$links_to_pages.'<br />'; $last_threads = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_text') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_topic') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('last_post') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('replies') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('views') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . " FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('section') . " = ".(int) $section_id." AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . " ORDER BY " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('last_post') . " DESC LIMIT ".$threads_per_page." OFFSET ".($page * $threads_per_page))->fetchAll(); if(isset($last_threads[0])) { $main_content .= '<table width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'" align="center"><td><font color="white" size="1"><b>Thread</b></font></td><td><font color="white" size="1"><b>Thread Starter</b></font></td><td><font color="white" size="1"><b>Replies</b></font></td><td><font color="white" size="1"><b>Views</b></font></td><td><font color="white" size="1"><b>Last Post</b></font></td></tr>'; foreach($last_threads as $thread) { if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<tr bgcolor="'.$bgcolor.'"><td>'; if($logged && $group_id_of_acc_logged >= $group_not_blocked) $main_content .= '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.htmlspecialchars($thread['post_topic']).' <?\')"><font color="red">[REMOVE]</font></a> '; $main_content .= '<a href="?subtopic=forum&action=show_thread&id='.$thread['id'].'">'.htmlspecialchars($thread['post_topic']).'</a><br /><small>'.htmlspecialchars(substr(removeBBCode($thread['post_text']), 0, 50)).'...</small></td><td><a href="?subtopic=characters&name='.urlencode($thread['name']).'">'.$thread['name'].'</a></td><td>'.(int) $thread['replies'].'</td><td>'.(int) $thread['views'].'</td><td>'; if($thread['last_post'] > 0) { $last_post = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . " FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = ".(int) $thread['id']." AND " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " ORDER BY " . $SQL->fieldName('post_date') . " DESC LIMIT 1")->fetch(); if(isset($last_post['name'])) $main_content .= date('d.m.y H:i:s', $last_post['post_date']).'<br />by <a href="?subtopic=characters&name='.urlencode($last_post['name']).'">'.$last_post['name'].'</a>'; else $main_content .= 'No posts.'; } else $main_content .= date('d.m.y H:i:s', $thread['post_date']).'<br />by <a href="?subtopic=characters&name='.urlencode($thread['name']).'">'.$thread['name'].'</a>'; $main_content .= '</td></tr>'; } $main_content .= '</table><br /><a href="?subtopic=forum&action=new_topic&section_id='.$section_id.'"><img src="images/forum/topic.gif" border="0" /></a>'; } else $main_content .= '<h3>No threads in this board.</h3>'; } if($action == 'show_thread') { $thread_id = (int) $_REQUEST['id']; $page = (int) $_REQUEST['page']; $thread_name = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_topic') . " FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = ".(int) $thread_id." AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " AND " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " LIMIT 1")->fetch(); if(!empty($thread_name['name'])) { $posts_count = $SQL->query("SELECT COUNT(" . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . ") AS posts_count FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = ".(int) $thread_id)->fetch(); for($i = 0; $i < $posts_count['posts_count'] / $threads_per_page; $i++) { if($i != $page) $links_to_pages .= '<a href="?subtopic=forum&action=show_thread&id='.$thread_id.'&page='.$i.'">'.($i + 1).'</a> '; else $links_to_pages .= '<b>'.($i + 1).' </b>'; } $threads = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('players') . "." . $SQL->fieldName('account_id') . ", " . $SQL->tableName('players') . "." . $SQL->fieldName('world_id') . ", " . $SQL->tableName('players') . "." . $SQL->fieldName('rank_id') . ", " . $SQL->tableName('players') . "." . $SQL->fieldName('vocation') . ", " . $SQL->tableName('players') . "." . $SQL->fieldName('promotion') . ", " . $SQL->tableName('players') . "." . $SQL->fieldName('level') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . "," . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('section') . "," . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_text') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_topic') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_smile') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_aid') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('last_edit_aid') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('edit_date') . " FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = ".(int) $thread_id." ORDER BY " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . " LIMIT ".$posts_per_page." OFFSET ".($page * $posts_per_page))->fetchAll(); if(isset($threads[0]['name'])) $SQL->query("UPDATE " . $SQL->tableName('z_forum') . " SET " . $SQL->fieldName('views') . "=" . $SQL->fieldName('views') . "+1 WHERE " . $SQL->fieldName('id') . " = ".(int) $thread_id); $main_content .= '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$threads[0]['section'].'">'.$sections[$threads[0]['section']].'</a> >> <b>'.htmlspecialchars($thread_name['post_topic']).'</b>'; $main_content .= '<br /><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a><br /><br />Page: '.$links_to_pages.'<br /><table width="100%"><tr bgcolor="'.$config['site']['lightborder'].'" width="100%"><td colspan="2"><font size="4"><b>'.htmlspecialchars($thread_name['post_topic']).'</b></font><font size="1"><br />by <a href="?subtopic=characters&name='.urlencode($thread_name['name']).'">'.htmlspecialchars($thread_name['name']).'</a></font></td></tr><tr bgcolor="'.$config['site']['vdarkborder'].'"><td width="200"><font color="white" size="1"><b>Author</b></font></td><td>&nbsp;</td></tr>'; foreach($threads as $thread) { if(!is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<tr bgcolor="'.$bgcolor.'"><td valign="top"><a href="?subtopic=characters&name='.urlencode($thread['name']).'">'.htmlspecialchars($thread['name']).'</a><br /><br /><font size="1">Profession: '.htmlspecialchars(Website::getVocationName($thread['vocation'], $thread['promotion'])).'<br />Level: '.$thread['level'].'<br />'; $rank = new GuildRank($thread['rank_id']); if($rank->isLoaded()) { $guild = $rank->getGuild(); if($guild->isLoaded()) $main_content .= htmlspecialchars($rank->getName()).' of <a href="?subtopic=guilds&action=show&guild='.$guild->getId().'">'.htmlspecialchars($guild->getName()).'</a><br />'; } $posts = $SQL->query("SELECT COUNT(" . $SQL->fieldName('id') . ") AS 'posts' FROM " . $SQL->tableName('z_forum') . " WHERE " . $SQL->fieldName('author_aid') . "=".(int) $thread['account_id'])->fetch(); $main_content .= '<br />Posts: '.(int) $posts['posts'].'<br /></font></td><td valign="top">'.showPost(htmlspecialchars($thread['post_topic']), htmlspecialchars($thread['post_text']), $thread['post_smile']).'</td></tr> <tr bgcolor="'.$bgcolor.'"><td><font size="1">'.date('d.m.y H:i:s', $thread['post_date']); if($thread['edit_date'] > 0) { if($thread['last_edit_aid'] != $thread['author_aid']) $main_content .= '<br />Edited by moderator'; else $main_content .= '<br />Edited by '.htmlspecialchars($thread['name']); $main_content .= '<br />on '.date('d.m.y H:i:s', $thread['edit_date']); } $main_content .= '</font></td><td>'; if($logged && $group_id_of_acc_logged >= $group_not_blocked) if($thread['first_post'] != $thread['id']) $main_content .= '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove post of '.htmlspecialchars($thread['name']).'?\')"><font color="red">REMOVE POST</font></a>'; else $main_content .= '<a href="?subtopic=forum&action=remove_post&id='.$thread['id'].'" onclick="return confirm(\'Are you sure you want remove thread > '.htmlspecialchars($thread['post_topic']).' <?\')"><font color="red">REMOVE THREAD</font></a>'; if($logged && ($thread['account_id'] == $account_logged->getId() || $group_id_of_acc_logged >= $group_not_blocked)) $main_content .= '<br/><a href="?subtopic=forum&action=edit_post&id='.$thread['id'].'">EDIT POST</a>'; if($logged) $main_content .= '<br/><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'&quote='.$thread['id'].'">Quote</a>'; $main_content .= '</td></tr>'; } $main_content .= '</table><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a><br /><center>Pages:<br />'.$links_to_pages.'<br /></center>'; } else $main_content .= 'Thread with this ID does not exits.'; } if($action == 'remove_post') { if($logged && $group_id_of_acc_logged >= $group_not_blocked) { $id = (int) $_REQUEST['id']; $post = $SQL->query("SELECT " . $SQL->fieldName('id') . ", " . $SQL->fieldName('first_post') . ", " . $SQL->fieldName('section') . " FROM " . $SQL->tableName('z_forum') . " WHERE " . $SQL->fieldName('id') . " = ".$id." LIMIT 1")->fetch(); if($post['id'] == $id) { if($post['id'] == $post['first_post']) { $SQL->query("DELETE FROM " . $SQL->tableName('z_forum') . " WHERE " . $SQL->fieldName('first_post') . " = ".$post['id']); header('Location: ?subtopic=forum&action=show_board&id='.$post['section']); } else { $post_page = $SQL->query("SELECT COUNT(" . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . ") AS posts_count FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . " < ".$id." AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = ".(int) $post['first_post'])->fetch(); $page = (int) ceil($post_page['posts_count'] / $threads_per_page) - 1; $SQL->query("UPDATE " . $SQL->tableName('z_forum') . " SET " . $SQL->fieldName('replies') . " = " . $SQL->fieldName('replies') . " - 1 WHERE " . $SQL->fieldName('id') . " = ".$post['first_post']); $SQL->query("DELETE FROM " . $SQL->tableName('z_forum') . " WHERE " . $SQL->fieldName('id') . " = ".$post['id']); header('Location: ?subtopic=forum&action=show_thread&id='.$post['first_post'].'&page='.(int) $page); } } else $main_content .= 'Post with ID '.$id.' does not exist.'; } else $main_content .= 'You are not logged in or you are not moderator.'; } if($action == 'new_post') { if($logged) { if(canPost($account_logged) || $group_id_of_acc_logged >= $group_not_blocked) { $players_from_account = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " FROM " . $SQL->tableName('players') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('account_id') . " = ".(int) $account_logged->getId())->fetchAll(); $thread_id = (int) $_REQUEST['thread_id']; $thread = $SQL->query("SELECT " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_topic') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('section') . " FROM " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . " = ".(int) $thread_id." AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = ".(int) $thread_id." LIMIT 1")->fetch(); $main_content .= '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$thread['section'].'">'.$sections[$thread['section']].'</a> >> <a href="?subtopic=forum&action=show_thread&id='.$thread_id.'">'.htmlspecialchars($thread['post_topic']).'</a> >> <b>Post new reply</b><br /><h3>'.htmlspecialchars($thread['post_topic']).'</h3>'; if(isset($thread['id'])) { $quote = (int) $_REQUEST['quote']; $text = trim(codeLower($_REQUEST['text'])); $char_id = (int) $_REQUEST['char_id']; $post_topic = trim($_REQUEST['topic']); $smile = (int) $_REQUEST['smile']; $saved = false; if(isset($_REQUEST['quote'])) { $quoted_post = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_text') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . " FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . " = ".(int) $quote)->fetchAll(); if(isset($quoted_post[0]['name'])) $text = '[i]Originally posted by '.$quoted_post[0]['name'].' on '.date('d.m.y H:i:s', $quoted_post[0]['post_date']).':[/i][quote]'.$quoted_post[0]['post_text'].'[/quote]'; } elseif(isset($_REQUEST['save'])) { $lenght = 0; for($i = 0; $i <= strlen($text); $i++) { if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126) $lenght++; } if($lenght < 1 || strlen($text) > 15000) $errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.'; if($char_id == 0) $errors[] = 'Please select a character.'; $player_on_account == false; if(count($errors) == 0) { foreach($players_from_account as $player) if($char_id == $player['id']) $player_on_account = true; if(!$player_on_account) $errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account'; } if(count($errors) == 0) { $last_post = $account_logged->getCustomField('last_post'); if($last_post+$post_interval-time() > 0 && $group_id_of_acc_logged < $group_not_blocked) $errors[] = 'You can post one time per '.$post_interval.' seconds. Next post after '.($last_post+$post_interval-time()).' second(s).'; } if(count($errors) == 0) { $saved = true; $account_logged->set('last_post', time()); $account_logged->save(); $SQL->query("INSERT INTO " . $SQL->tableName('z_forum') . " (" . $SQL->fieldName('first_post') . " ," . $SQL->fieldName('last_post') . " ," . $SQL->fieldName('section') . " ," . $SQL->fieldName('replies') . " ," . $SQL->fieldName('views') . " ," . $SQL->fieldName('author_aid') . " ," . $SQL->fieldName('author_guid') . " ," . $SQL->fieldName('post_text') . " ," . $SQL->fieldName('post_topic') . " ," . $SQL->fieldName('post_smile') . " ," . $SQL->fieldName('post_date') . " ," . $SQL->fieldName('last_edit_aid') . " ," . $SQL->fieldName('edit_date') . ", " . $SQL->fieldName('post_ip') . ") VALUES ('".$thread['id']."', '0', '".$thread['section']."', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$SQL->quote($text).", ".$SQL->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."')"); $SQL->query("UPDATE " . $SQL->tableName('z_forum') . " SET " . $SQL->fieldName('replies') . "=" . $SQL->fieldName('replies') . "+1, " . $SQL->fieldName('last_post') . "=".time()." WHERE " . $SQL->fieldName('id') . " = ".(int) $thread_id); $post_page = $SQL->query("SELECT COUNT(" . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . ") AS posts_count FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . " <= ".time()." AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = ".(int) $thread['id'])->fetch(); $page = (int) ceil($post_page['posts_count'] / $threads_per_page) - 1; header('Location: ?subtopic=forum&action=show_thread&id='.$thread_id.'&page='.$page); $main_content .= '<br />Thank you for posting.<br /><a href="?subtopic=forum&action=show_thread&id='.$thread_id.'">GO BACK TO LAST THREAD</a>'; } } if(!$saved) { if(count($errors) > 0) { $main_content .= '<font color="red" size="2"><b>Errors occured:</b>'; foreach($errors as $error) $main_content .= '<br />* '.$error; $main_content .= '</font><br />'; } $main_content .= '<form action="?" method="POST"><input type="hidden" name="action" value="new_post" /><input type="hidden" name="thread_id" value="'.$thread_id.'" /><input type="hidden" name="subtopic" value="forum" /><input type="hidden" name="save" value="save" /><table width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2"><font color="white"><b>Post New Reply</b></font></td></tr><tr bgcolor="'.$config['site']['darkborder'].'"><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>'; foreach($players_from_account as $player) { $main_content .= '<option value="'.$player['id'].'"'; if($player['id'] == $char_id) $main_content .= ' selected="selected"'; $main_content .= '>'.$player['name'].'</option>'; } $main_content .= '</select></td></tr><tr bgcolor="'.$config['site']['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" name="topic" value="'.htmlspecialchars($post_topic).'" size="40" maxlength="60" /> (Optional)</td></tr> <tr bgcolor="'.$config['site']['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url=http://address.com/]Address Search - Find Email and Addresses @ Address.com[/url]<br />[img=http://images.com/images3.gif]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr> <tr bgcolor="'.$config['site']['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"'; if($smile == 1) $main_content .= ' checked="checked"'; $main_content .= '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Post Reply" /></center></form>'; $threads = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_text') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_topic') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_smile') . " FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = ".(int) $thread_id." ORDER BY " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . " DESC LIMIT 10")->fetchAll(); $main_content .= '<table width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2"><font color="white"><b>Last 5 posts from thread: '.htmlspecialchars($thread['post_topic']).'</b></font></td></tr>'; foreach($threads as $thread) { if(is_int($number_of_rows / 2)) { $bgcolor = $config['site']['darkborder']; } else { $bgcolor = $config['site']['lightborder']; } $number_of_rows++; $main_content .= '<tr bgcolor="'.$bgcolor.'"><td>'.$thread['name'].'</td><td>'.showPost(htmlspecialchars($thread['post_topic']), htmlspecialchars($thread['post_text']), $thread['post_smile']).'</td></tr>'; } $main_content .= '</table>'; } } else $main_content .= 'Thread with ID '.$thread_id.' doesn\'t exist.'; } else $main_content .= 'Your account is banned, deleted or you don\'t have any player with level '.$level_limit.' on your account. You can\'t post.'; } else $main_content .= 'Login first.'; } if($action == 'edit_post') { if($logged) { if(canPost($account_logged) || $group_id_of_acc_logged >= $group_not_blocked) { $post_id = (int) $_REQUEST['id']; $thread = $SQL->query("SELECT " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_aid') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_topic') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_text') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_smile') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('section') . " FROM " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . " = ".(int) $post_id." LIMIT 1")->fetch(); if(isset($thread['id'])) { $first_post = $SQL->query("SELECT " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_aid') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_topic') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_text') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_smile') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . ", " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('section') . " FROM " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . " = ".(int) $thread['first_post']." LIMIT 1")->fetch(); $main_content .= '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$thread['section'].'">'.$sections[$thread['section']].'</a> >> <a href="?subtopic=forum&action=show_thread&id='.$thread['first_post'].'">'.htmlspecialchars($first_post['post_topic']).'</a> >> <b>Edit post</b>'; if($account_logged->getId() == $thread['author_aid'] || $group_id_of_acc_logged >= $group_not_blocked) { $players_from_account = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " FROM " . $SQL->tableName('players') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('account_id') . " = ".(int) $account_logged->getId())->fetchAll(); $saved = false; if(isset($_REQUEST['save'])) { $text = trim(codeLower($_REQUEST['text'])); $char_id = (int) $_REQUEST['char_id']; $post_topic = trim($_REQUEST['topic']); $smile = (int) $_REQUEST['smile']; $lenght = 0; for($i = 0; $i <= strlen($post_topic); $i++) { if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126) $lenght++; } if(($lenght < 1 || strlen($post_topic) > 60) && $thread['id'] == $thread['first_post']) $errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.'; $lenght = 0; for($i = 0; $i <= strlen($text); $i++) { if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126) $lenght++; } if($lenght < 1 || strlen($text) > 15000) $errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.'; if($char_id == 0) $errors[] = 'Please select a character.'; if(empty($post_topic) && $thread['id'] == $thread['first_post']) $errors[] = 'Thread topic can\'t be empty.'; $player_on_account == false; if(count($errors) == 0) { foreach($players_from_account as $player) if($char_id == $player['id']) $player_on_account = true; if(!$player_on_account) $errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account'; } if(count($errors) == 0) { $saved = true; if($account_logged->getId() != $thread['author_aid']) $char_id = $thread['author_guid']; $SQL->query("UPDATE " . $SQL->tableName('z_forum') . " SET " . $SQL->fieldName('author_guid') . " = ".(int) $char_id.", " . $SQL->fieldName('post_text') . " = ".$SQL->quote($text).", " . $SQL->fieldName('post_topic') . " = ".$SQL->quote($post_topic).", " . $SQL->fieldName('post_smile') . " = ".(int) $smile.", " . $SQL->fieldName('last_edit_aid') . " = ".(int) $account_logged->getId()."," . $SQL->fieldName('edit_date') . " = ".time()." WHERE " . $SQL->fieldName('id') . " = ".(int) $thread['id']); $post_page = $SQL->query("SELECT COUNT(" . $SQL->tableName('z_forum') . "." . $SQL->fieldName('id') . ") AS posts_count FROM " . $SQL->tableName('players') . ", " . $SQL->tableName('z_forum') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " = " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('author_guid') . " AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('post_date') . " <= ".$thread['post_date']." AND " . $SQL->tableName('z_forum') . "." . $SQL->fieldName('first_post') . " = ".(int) $thread['first_post'])->fetch(); $page = (int) ceil($post_page['posts_count'] / $threads_per_page) - 1; header('Location: ?subtopic=forum&action=show_thread&id='.$thread['first_post'].'&page='.$page); $main_content .= '<br />Thank you for editing post.<br /><a href="?subtopic=forum&action=show_thread&id='.$thread['first_post'].'">GO BACK TO LAST THREAD</a>'; } } else { $text = $thread['post_text']; $char_id = (int) $thread['author_guid']; $post_topic = $thread['post_topic']; $smile = (int) $thread['post_smile']; } if(!$saved) { if(count($errors) > 0) { $main_content .= '<br /><font color="red" size="2"><b>Errors occured:</b>'; foreach($errors as $error) $main_content .= '<br />* '.$error; $main_content .= '</font>'; } $main_content .= '<br /><form action="?" method="POST"><input type="hidden" name="action" value="edit_post" /><input type="hidden" name="id" value="'.$post_id.'" /><input type="hidden" name="subtopic" value="forum" /><input type="hidden" name="save" value="save" /><table width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2"><font color="white"><b>Edit Post</b></font></td></tr><tr bgcolor="'.$config['site']['darkborder'].'"><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>'; foreach($players_from_account as $player) { $main_content .= '<option value="'.$player['id'].'"'; if($player['id'] == $char_id) $main_content .= ' selected="selected"'; $main_content .= '>'.$player['name'].'</option>'; } $main_content .= '</select></td></tr><tr bgcolor="'.$config['site']['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" value="'.htmlspecialchars($post_topic).'" name="topic" size="40" maxlength="60" /> (Optional)</td></tr> <tr bgcolor="'.$config['site']['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url=http://address.com/]Address Search - Find Email and Addresses @ Address.com[/url]<br />[img=http://images.com/images3.gif]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr> <tr bgcolor="'.$config['site']['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"'; if($smile == 1) $main_content .= ' checked="checked"'; $main_content .= '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Save Post" /></center></form>'; } } else $main_content .= '<br />You are not an author of this post.'; } else $main_content .= '<br />Post with ID '.$post_id.' doesn\'t exist.'; } else $main_content .= '<br />Your account is banned, deleted or you don\'t have any player with level '.$level_limit.' on your account. You can\'t post.'; } else $main_content .= '<br />Login first.'; } if($action == 'new_topic') { if($logged) { if(canPost($account_logged) || $group_id_of_acc_logged >= $group_not_blocked) { $players_from_account = $SQL->query("SELECT " . $SQL->tableName('players') . "." . $SQL->fieldName('name') . ", " . $SQL->tableName('players') . "." . $SQL->fieldName('id') . " FROM " . $SQL->tableName('players') . " WHERE " . $SQL->tableName('players') . "." . $SQL->fieldName('account_id') . " = ".(int) $account_logged->getId())->fetchAll(); $section_id = (int) $_REQUEST['section_id']; $main_content .= '<a href="?subtopic=forum">Boards</a> >> <a href="?subtopic=forum&action=show_board&id='.$section_id.'">'.$sections[$section_id].'</a> >> <b>Post new thread</b><br />'; if(isset($sections[$section_id])) { if($section_id == 1 && $group_id_of_acc_logged < $group_not_blocked) $errors[] = 'Only moderators and admins can post on news board.'; $quote = (int) $_REQUEST['quote']; $text = trim(codeLower($_REQUEST['text'])); $char_id = (int) $_REQUEST['char_id']; $post_topic = trim($_REQUEST['topic']); $smile = (int) $_REQUEST['smile']; $saved = false; if(isset($_REQUEST['save'])) { $lenght = 0; for($i = 0; $i <= strlen($post_topic); $i++) { if(ord($post_topic[$i]) >= 33 && ord($post_topic[$i]) <= 126) $lenght++; } if($lenght < 1 || strlen($post_topic) > 60) $errors[] = 'Too short or too long topic (short: '.$lenght.' long: '.strlen($post_topic).' letters). Minimum 1 letter, maximum 60 letters.'; $lenght = 0; for($i = 0; $i <= strlen($text); $i++) { if(ord($text[$i]) >= 33 && ord($text[$i]) <= 126) $lenght++; } if($lenght < 1 || strlen($text) > 15000) $errors[] = 'Too short or too long post (short: '.$lenght.' long: '.strlen($text).' letters). Minimum 1 letter, maximum 15000 letters.'; if($char_id == 0) $errors[] = 'Please select a character.'; $player_on_account == false; if(count($errors) == 0) { foreach($players_from_account as $player) if($char_id == $player['id']) $player_on_account = true; if(!$player_on_account) $errors[] = 'Player with selected ID '.$char_id.' doesn\'t exist or isn\'t on your account'; } if(count($errors) == 0) { $last_post = $account_logged->getCustomField('last_post'); if($last_post+$post_interval-time() > 0 && $group_id_of_acc_logged < $group_not_blocked) $errors[] = 'You can post one time per '.$post_interval.' seconds. Next post after '.($last_post+$post_interval-time()).' second(s).'; } if(count($errors) == 0) { $saved = true; $account_logged->set('last_post', time()); $account_logged->save(); $SQL->query("INSERT INTO " . $SQL->tableName('z_forum') . " (" . $SQL->fieldName('first_post') . " ," . $SQL->fieldName('last_post') . " ," . $SQL->fieldName('section') . " ," . $SQL->fieldName('replies') . " ," . $SQL->fieldName('views') . " ," . $SQL->fieldName('author_aid') . " ," . $SQL->fieldName('author_guid') . " ," . $SQL->fieldName('post_text') . " ," . $SQL->fieldName('post_topic') . " ," . $SQL->fieldName('post_smile') . " ," . $SQL->fieldName('post_date') . " ," . $SQL->fieldName('last_edit_aid') . " ," . $SQL->fieldName('edit_date') . ", " . $SQL->fieldName('post_ip') . ") VALUES ('0', '".time()."', '".(int) $section_id."', '0', '0', '".$account_logged->getId()."', '".(int) $char_id."', ".$SQL->quote($text).", ".$SQL->quote($post_topic).", '".(int) $smile."', '".time()."', '0', '0', '".$_SERVER['REMOTE_ADDR']."')"); $thread_id = $SQL->lastInsertId(); $SQL->query("UPDATE " . $SQL->tableName('z_forum') . " SET " . $SQL->fieldName('first_post') . "=".(int) $thread_id." WHERE " . $SQL->fieldName('id') . " = ".(int) $thread_id); header('Location: ?subtopic=forum&action=show_thread&id='.$thread_id); $main_content .= '<br />Thank you for posting.<br /><a href="?subtopic=forum&action=show_thread&id='.$thread_id.'">GO BACK TO LAST THREAD</a>'; } } if(!$saved) { if(count($errors) > 0) { $main_content .= '<font color="red" size="2"><b>Errors occured:</b>'; foreach($errors as $error) $main_content .= '<br />* '.$error; $main_content .= '</font><br />'; } $main_content .= '<form action="?" method="POST"><input type="hidden" name="action" value="new_topic" /><input type="hidden" name="section_id" value="'.$section_id.'" /><input type="hidden" name="subtopic" value="forum" /><input type="hidden" name="save" value="save" /><table width="100%"><tr bgcolor="'.$config['site']['vdarkborder'].'"><td colspan="2"><font color="white"><b>Post New Reply</b></font></td></tr><tr bgcolor="'.$config['site']['darkborder'].'"><td width="180"><b>Character:</b></td><td><select name="char_id"><option value="0">(Choose character)</option>'; foreach($players_from_account as $player) { $main_content .= '<option value="'.$player['id'].'"'; if($player['id'] == $char_id) $main_content .= ' selected="selected"'; $main_content .= '>'.$player['name'].'</option>'; } $main_content .= '</select></td></tr><tr bgcolor="'.$config['site']['lightborder'].'"><td><b>Topic:</b></td><td><input type="text" name="topic" value="'.htmlspecialchars($post_topic).'" size="40" maxlength="60" /> (Optional)</td></tr> <tr bgcolor="'.$config['site']['darkborder'].'"><td valign="top"><b>Message:</b><font size="1"><br />You can use:<br />[player]Nick[/player]<br />[url=http://address.com/]Address Search - Find Email and Addresses @ Address.com[/url]<br />[img=http://images.com/images3.gif]<br />[code]Code[/code]<br />[b]<b>Text</b>[/b]<br />[i]<i>Text</i>[/i]<br />[u]<u>Text</u>[/u]<br />and smileys:<br />;) , :) , :D , :( , :rolleyes:<br />:cool: , :eek: , :o , :p</font></td><td><textarea rows="10" cols="60" name="text">'.htmlspecialchars($text).'</textarea><br />(Max. 15,000 letters)</td></tr> <tr bgcolor="'.$config['site']['lightborder'].'"><td valign="top">Options:</td><td><label><input type="checkbox" name="smile" value="1"'; if($smile == 1) $main_content .= ' checked="checked"'; $main_content .= '/>Disable Smileys in This Post </label></td></tr></table><center><input type="submit" value="Post Thread" /></center></form>'; } } else $main_content .= 'Board with ID '.$board_id.' doesn\'t exist.'; } else $main_content .= 'Your account is banned, deleted or you don\'t have any player with level '.$level_limit.' on your account. You can\'t post.'; } else $main_content .= 'Login first.'; }
  17. Ak_Ray

    Include e Require não funcionam - PHP

    Pessoal, a pouco tempo troquei o xampp pelo php direto na máquina, o problema é que quando inicio o servidor o require nem o include funcionam. Acredito que o problema seja no php.ini, já tentei fazer diversas alterações, mas nenhuma funcionou. Linha onde acredito que esteja o problema : ; UNIX: “/path1:/path2” include_path = “.:/php/includes” ; ; Windows: “\path1;\path2” ;include_path = “.;c:\php\includes” Essa é a configuração padrão, apenas fiz uma alteração abaixo da linha “Unix” tirando o ';", já que no arquivo de php.ini do xampp estava assim. Mesmo assim não funciona =/ Diretório onde esta a pasta php: C:\php Ps: tenho certeza que estou chamando o arquivo corretamente, tanto que com o Xampp funcionava normalmente.
  18. Seguinte. Estou tendo dificuldades em criar um array a partir de outro array. E o que preciso é que a saída seja exatamente assim: $dados_out = array( 'nome' => 'Nome do Aluno', 'diciplina_notas' => array( array('PORTUGUÊS', '7ano' => '7,5', '8ano' => '7,0', '9ano' => '8,0'), array('REDAÇÃO', '7ano' => '8,5', '8ano' => '9,0', '9ano' => '9,0'), array('HISTÓRIA', '7ano' => '9,5', '8ano' => '8,5', '9ano' => '8,5'), array('GEOGRAFICA', '7ano' => '7,0', '8ano' => '8,5', '9ano' => '8,0'), array('QUIMICA', '7ano' => '--', '8ano' => '--', '9ano' => '8,5'), ) ); A partir deste código: $dados = array( array( 'nome'=> 'Nome do Aluno', 'etapa'=> '7º ANO', 'pos' => 7, 'not_dados'=> array( array('PORTUGUES', '7,5', '120H', 'AP'), array('REDAÇÃO', '8,5', '40H', 'AP'), array('HISTÓRIA', '9,0', '80H', 'AP'), array('GEOGRAFIA', '7,0', '80H', 'AP') ) ), array( 'nome'=> 'Nome do Aluno', 'etapa'=> '8º ANO', 'pos' => 8, 'not_dados'=> array( array('PORTUGUES', '7,0', '120H', 'AP'), array('HISTÓRIA', '8,5', '80H', 'AP'), array('REDAÇÃO', '9,0', '40H', 'AP'), array('GEOGRAFIA', '8,5', '80H', 'AP') ) ), array( 'nome'=> 'Nome do Aluno', 'etapa'=> '9º ANO', 'pos' => 9, 'not_dados'=> array( array('PORTUGUES', '8,0', '120H', 'AP'), array('HISTÓRIA', '8,5', '80H', 'AP'), array('REDAÇÃO', '9,0', '40H', 'AP'), array('GEOGRAFIA', '8,0', '80H', 'AP'), array('QUIMICA', '8,5', '80H', 'AP') ) ), ); OBS: terá todas as etapas e as diciplinas não podem ser repetidas. Quem puder ajudar desde já agradeço.
  19. Sapinn

    Como gerar um nome de usuário?

    Salve galera, firmeza? Tenho uma aplicação web e gostaria de criar um nome de usuário único para cada usuário que se cadastrar no meu site misturando seu nome e acrescentando letras e números. Por exemplo: Nome: João Maria José Nome_gerado: joao.maria_jose278327 Alguém sabe como fazer?
  20. $rst_pedidos=mysql_query("SELECT * FROM pedidos WHERE situacaopedido='ENVIADO' ORDER BY situacaopedido",$link);
  21. Olá pessoal boa tarde, gostaria de saber se conseguem me ajudar. Hoje tenho um sistema que contempla o site e uma área administrativa, tudo feito em Codigniter, mas que começou a ficar muito grande, devido as diversas funcionalidades e estava pensando em reestruturar, mas estou bem confuso como poderia estruturar, se criando um RESTFull e conectando tanto o site quanto o administrativo, usar php com um VUE, React, Node, etc. Fico imaginando o seguinte e gostaria da opinião de vcs: - criar um restfull através de uma url tipo api.dominio.com.br - criar as conexões do admin usando react ou vue onde o usuário acessaria pela url app.dominio.com.br - criar as conexões do site usando react ou vue onde o usuário acessaria pela url www.dominio.com.br O que acham? Fico com receio da quantidade de administração / controle que teria para poder atualizar, etc. Conseguiriam me dar uma luz? Lembrando que este sistema posso usar para diferentes clientes com o mesmo nicho de negócio, se alguém puder me ajudar agradeço e desculpe o email longo, eu hoje uso PHP, MySQL, Mustache, JQuery Obrigado
  22. Rzorr

    Url, Busca

    Bom dia, eu tenho um site de imóveis, sou corretor, ele está com alguns problemas na URL, comprei esse script e venho fazendo algumas alterações nele, sei o básico, cadastrar, deletar, buscar, update, mas o que acontece esse site foi construido com MVC e confesso parei de estudar PHP faz muito tempo, e não entendo nada de MVC, abaixo o código da busca e como forma o link é montado. No site o link fica assim: /imoveis/lista/referencia/referencia/categoria/comprar/tipo/tipo/cidade/Camboriú/bairro/bairro#busca nesse exemplo fiz uma busca pela cidade! Se clico no menu em vendas o link fica assim: /imoveis/lista/referencia/referencia/categoria/comprar/tipo/tipo/cidade/cidade/bairro/bairro#busca pessoal obrigado pela disposição em ajudar, eu to tentando resolver faz dias, mas não consigo entender a a forma como é construido. <?php class busca extends controller { public function init(){ } public function inicial(){ $referencia = $this->post('referencia'); $categoria = $this->post('categoria'); $tipo = $this->post('tipo'); $cidade = $this->post('cidade'); $bairro = $this->post('bairro'); if($referencia){ $cidade = "cidade"; $bairro = "bairro"; $tipo = "tipo"; $categoria = "categoria"; } else { $referencia = 'referencia'; if(!$categoria){ $categoria = "categoria"; } if(!$tipo){ $tipo = "tipo"; } if(!$cidade){ $cidade = "cidade"; } if(!$bairro){ $bairro = "bairro"; } } $endereco = DOMINIO."imoveis/lista/referencia/$referencia/categoria/$categoria/tipo/$tipo/cidade/$cidade/bairro/$bairro#busca"; $this->irpara("$endereco"); }
  23. gersonab

    Consulta aparece em um servidor, no outro não.

    Boa tarde, tenho uma consulta onde retorno dados de várias tabelas, em um servidor ela funciona perfeitamente, no outro não retorna os campos longtext, fica vazio. <?php $id=(int)$_GET['idc']; $consulta3 = $pdo->query("SELECT * FROM proc INNER JOIN cli ON idc=part LEFT JOIN posicao ON idpos=posic WHERE idc=$id"); while($user3 = $consulta3->fetch(PDO::FETCH_ASSOC)){ $idpr = $user3['idpr']; $reup = $user3['reup']; //// vários campos, todos retornando normal $leb = str_replace('"','-',$user3['leb']); $obsp = str_replace('"','-',$user3['obsp']); ?> <p>Andamento : <?php echo nl2br($obsp);?> </p> /// não retorna, ou <p>Andamento : <?php echo $obsp;?> </p> /// também não retorna porém no servidor que eu trabalho funciona normalmente já no servidor do cliente que é na kinghost o mesmo não retorna estes dados, o que pode ser ?
  24. Fredo

    Sistema de propinas

    Boa tarde pessoal. Espero que estejam indo bem apesar dessa Covid que esta no mundo todo. Tenho um sistema escolar. Estou a fazer a parte das propinas. Gostaria de uma ajuda sobre a logica para cobrar dividas e multas quando o estudante passa do prazo do pagamento (depois do dis 15 do mes) Agradeco Fredo
  25. Hugo Lima

    Ajuda, Update de Legenda em upload de multiplas fotos?

    Eu tenho um sistema que, depois de carregar várias fotos, gera um campo de legendas para cada foto, desejo atualizar o banco de dados dessas legendas. Como fazer isso. Minha tabela no banco de dados - tabela tb_fotos_portfolio (id, id_portfolio, legenda, arquivo). Obs.: Seria apenas a parte de UPDATE das legendas no banco de dados. ... <?php $sql = "SELECT * FROM tb_fotos_portfolio WHERE id_portfolio = $id"; $query = $DB->Select($sql); if (count($query) == 0) { ?> <div class="box-body"> <h3 class="text-center text-danger" style="margin: 140px 0;">Imagem não enviada!</h3> </div> <?php } else { ?> <div class="box-body no-padding"> <ul class="users-list clearfix"> <?php foreach($query as $item) { ?> <li> <a class="popup-link" href="../../../upload/portfolio/imagem/<?php echo $item['arquivo']; ?>"> <img src="../../../upload/portfolio/miniatura/<?php echo $item['arquivo']; ?>" alt="<?php echo $item['arquivo']; ?>"/> <span class="users-list-name"><?php echo $item['arquivo']; ?></span> </a> <a class="btn btn-label btn-danger btn-xs" href="acoes.php?acao=deleteFotos&id=<?php echo $_GET['id'];?>&arquivo=<?php echo $item['arquivo'];?>"><i class="fal fa-trash-alt"></i>Excluir</a> <span class="users-list-name"><?php echo $item['legenda']; ?></span> <form id="" action="acoes.php?acao=legendas_fotos" method="post" enctype="multipart/form-data"> <input type="text" name="legenda[]" id="legenda" class="form-control" placeholder="Legenda" value="<?php echo $item['legenda']; ?>"/> </li> <?php } ?> </ul><!-- /.users-list --> </div> <button type="submit" class="btn btn-success btn-label btn-sm"><i class="fa fa-check"></i> Atualizar Legendas</button> </form> .... acao.php case 'legendas_fotos': $legenda = $_POST['legenda']; $sql = "UPDATE tb_fotos_portfolio SET legenda= $legenda WHERE id=:id"; $vCampos = array('id'=>$id); $DB->Execute($sql, $vCampos); // Volta para o form header("location:form.php?id=" . $id); exit; break
×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.