Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Olá, venho trazer um conteúdo bem bacana pra vocês, que já vi em outros servidores e gostei bastante. Talvez alguns cobrariam por isso, mas venho trazer de gratix brozito.

 

image.thumb.png.0c3af8c45af31af3f0176283543e09a9.png

 

 

O sistema basicamente procura no banco de dados todos os nomes que contém "Pedro" ou o que você digitar. 

 

Seria um pouco complicado para quem não entende instalar, mas vamos lá, após isso eu vou deixar o characters.php que utilizei aqui.

 

Primeiramente em characters.php você vai da um ctrl + f e procurar por $name = '';  acredito que seja uma das primeiras coisas do seu php, após isso você vai substituir

 

$name = '';
if(isset($_REQUEST['name']))
	$name = (string) $_REQUEST['name'];
if(!empty($name))
{
	$player = new Player();
	$player->find($name);
	if($player->isLoaded())
	{

por

$name = '';
if(isset($_REQUEST['name']))
    $name = (string) $_REQUEST['name'];
 
if(!empty($_REQUEST['view'])
&& isset($_REQUEST['view'])){
    if($_REQUEST['view'] == "matches"){
 
        $main_content .= '<BR><BR>
            <FORM ACTION="?subtopic=characters&view=matches" METHOD=post>
                <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
                    <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR>
                    <TR>
                        <TD BGCOLOR="'.$config['site']['darkborder'].'">
                            <TABLE BORDER=0 CELLPADDING=1>
                                <TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD>
                                <INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR>
                            </TABLE>
                        </TD>
                    </TR>
                </TABLE>
            </FORM>';
        $main_content .= '</TABLE>';
 
        if(isset($name) && !empty($name)){
            $matches = $SQL->query('SELECT * FROM `players` WHERE `name` LIKE '.$SQL->quote("%".$name."%").' LIMIT 25')->fetchAll();
 
            if(count($matches) > 0){
                foreach($matches as $match){
                    $sim = similar_text(strtolower($name), strtolower($match['name']), $pct);
                    $match["similarity"] = $pct;
                }
 
                //arsort($matches);
                for($i = 0; $i < count($fruits)-1; $i++){
                    for($j = 0; $j < (count($fruits)-1)-$i; $j++){
                        if($fruits[$j]["similarity"] < $fruits[$j+1]["similarity"]){
                            $temp = $fruits[$j];
                            $fruits[$j] = $fruits[$j+1];
                            $fruits[$j+1] = $temp;
                        }
                    }
                }
 
                $main_content.='<table style="width:100%;" cellspacing="1" cellpadding="4" border="0">
                <tr><td class="white" bgcolor="#505050" colspan="2"><b>Matches Found</b> - Keyword(s): '.$name.'</td></tr>';
                    foreach($matches as $index => $player){
                        $main_content.="
                        <tr bgcolor=\"#D4C0A1\">
                            <td><a href=\"/?subtopic=characters&name=".urlencode($player['name'])."\">".$player["name"]."</td>
                            <td>[ ".$player["level"]." ]</td>
                        </tr>";
                    }
                $main_content.="</table>";
            } else {
 
                $main_content.="<b>No matches found. Keyword: ".$name." </b>";
 
            }
            //print_r($matches);
        } else {
            $main_content .= "<b>Warning: Search parameter empty</b>";
        }
    }
} else {
        if(!empty($name))
        {
            $player = new Player();
            $player->find($name);
            if($player->isLoaded())
            {

beleza, após isso você vai precisar fechar o if. 

Você vai da um ctrl + f ou procurar por algo parecido com 

$search_errors[] = 'Character <b>'.htmlspecialchars($name)

então você vai substituir 

		$search_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> does not exist.';	
}
if(!empty($search_errors))
{
	$main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
	foreach($search_errors as $search_error)
		$main_content .= '<li>'.$search_error;
	$main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
}
$main_content .= '<BR><BR><FORM ACTION="?subtopic=characters" METHOD=post><TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4><TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR><TR><TD BGCOLOR="'.$config['site']['darkborder'].'"><TABLE BORDER=0 CELLPADDING=1><TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD><INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR></TABLE></TD></TR></TABLE></FORM>';
$main_content .= '</TABLE>';

por

				$search_errors[] = 'Character <b>'.htmlspecialchars($name).'</b> does not exist.';
        }
}
 
if(!isset($_REQUEST['view'])){
    if(!empty($search_errors))
    {
        $main_content .= '<div class="SmallBox" >  <div class="MessageContainer" >    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeLeftTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeRightTop" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="ErrorMessage" >      <div class="BoxFrameVerticalLeft" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="BoxFrameVerticalRight" style="background-image:url('.$layout_name.'/images/content/box-frame-vertical.gif);" /></div>      <div class="AttentionSign" style="background-image:url('.$layout_name.'/images/content/attentionsign.gif);" /></div><b>The Following Errors Have Occurred:</b><br/>';
        foreach($search_errors as $search_error)
        $main_content .= '<li>'.$search_error;
        $main_content .= '</div>    <div class="BoxFrameHorizontal" style="background-image:url('.$layout_name.'/images/content/box-frame-horizontal.gif);" /></div>    <div class="BoxFrameEdgeRightBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>    <div class="BoxFrameEdgeLeftBottom" style="background-image:url('.$layout_name.'/images/content/box-frame-edge.gif);" /></div>  </div></div><br/>';
    }
    $main_content .= '<BR><BR>
    <FORM ACTION="?subtopic=characters&view=matches" METHOD=post>
    <TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
    <TR><TD BGCOLOR="'.$config['site']['vdarkborder'].'" CLASS=white><B>Search Character</B></TD></TR>
    <TR><TD BGCOLOR="'.$config['site']['darkborder'].'">
    <TABLE BORDER=0 CELLPADDING=1>
    <TR><TD>Name:</TD><TD><INPUT NAME="name" VALUE=""SIZE=29 MAXLENGTH=29></TD><TD>
    <INPUT TYPE=image NAME="Submit" SRC="'.$layout_name.'/images/buttons/sbutton_submit.gif" BORDER=0 WIDTH=120 HEIGHT=18></TD></TR>
    </TABLE></TD></TR>
    </TABLE>
    </FORM>';
    $main_content .= '</TABLE>';
}

 

 

vou deixar aqui também o código inteiro do characters.php

 

https://pastebin.com/uqJ8JyUR

 

 

é isto, abraços.

 

créditos ao brozito do snavy, ricardin codenome, gian e lobão, que me ajudaram.

 

Editado por Yinz (veja o histórico de edições)

Postado

Parabéns, seu tópico de conteúdo foi aprovado!
Muito obrigado pela sua contribuição, nós do Tibia King agradecemos.
Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP.

Spoiler

Congratulations, your content has been approved!
Thank you for your contribution, we of Tibia King we are grateful.
Your content will help many other users, you received +1 REP.

 

Projeto ATS (Naruto)

Informações Abaixo

Facebook

Youtube
Discord

 

Tutoriais / Conteúdos

Clique Aqui

Postado

@Yinz Tenque iu Mestre Hatake

Meu Curso sobre Programação para OTServer

Programando OTServer

 

Peça o seu script! Entre agora mesmo no grupo

Developing

 

Conteúdos:

 

Discord: Belmont#7352

Não esqueça do REP+ :)     

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo