Secret Experience

Secret Experience (https://secretexperience.net/index.php)
-   [L2J] Dúvidas (https://secretexperience.net/forumdisplay.php?f=37)
-   -   [Web Site] Ajuda com uso de Scrip (https://secretexperience.net/showthread.php?t=11607)

Misho 15-08-2009 03:23 AM

Pessoal peguei alguns Scrip nesse Topico


[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]


Os Scrip sao:

Status dos Castle

cria pagina de rank,pvp,pk,karma,lv




Queria saber agora como ADD eles na minha Pagina



Se possivel um tutorial ou uma explicaçao bem detalhada

Pessoal impossivel que tantos programoderes aqui do Forum ninguem sabe me dizer oNDE e como devo add os Scrip no meu Site..

Aqui uma parte da Index do site>

Citação:

<li class="subNavContainer">
<a class="subNavLink" id="news_from_abroad" href="1">Top PVP</a>
</li>
<li class="subNavContainer">
<a class="subNavLink" id="general_news" href="1">Top PK</a>
</li>
<li class="subNavContainer">
<a class="subNavLink" id="developer_blogs" href="1">Top Online</a>
</li>
<li class="subNavContainer">
<a class="subNavLink" id="developer_blogs" href="1">Top Voters</a>
</li>
<li class="subNavContainer">
<a class="subNavLink" id="developer_blogs" href="1">Top Clans</a>
</li>
</table>
</body>


</html>

Apenas digam o que devo add e em qual pasta e como configurar os botoes pra redirecionar pros top...



EDIT:PROBLEMA RESOLVIO, PODE MOVER O TOPICO

Setokaiba 15-08-2009 05:54 PM

Recapitulando, vamos lá:

Estes são scripts funcionais que podem ser inseridos em alguma parte de sua página.
Eu recomendo que utilize um editor de páginas web, como o Dreamweaver e inserir o código na parte desejada do layout.
Se pois os arquivos já prontos dentro de algum diretório, para abrirem em nova janela ou em _self mesmo o que tem que editar é o href do código: href="PONDO AQUI O DIRETÓRIO E O NOME DO ARQUIVO DO SCRIPT SEGUIDO DA TERMINAÇÃO .php"

Não se esqueça de configurar as propriedades de conexão com o banco de dados, e utilize também um bom gerenciador de web sites, como o Abyss Web Server X1.

Misho 15-08-2009 06:19 PM

Seto aqui eu deixei a pasta Script dentro da WWW, editei os Botoes e ficaram assim:

Código:

<li class="subNavContainer">
    <a class="subNavLink" id="news_from_abroad" href="Script/pvpkills.php">Top PVP</a>
  </li>
  <li class="subNavContainer">
    <a class="subNavLink" id="general_news" href="Script/pkkills">Top PK</a>
  </li>
  <li class="subNavContainer">
    <a class="subNavLink" id="developer_blogs" href="Script/online.php">Top Online</a>
  </li>
  <li class="subNavContainer">
    <a  href="Top Voters.html" class="subNavLink" id="developer_blogs">Top Voters</a>
  </li>
  <li class="subNavContainer">
    <a class="subNavLink" id="developer_blogs" href="Script/clan.php">Top Clans</a>
  </li>



Mesmo assim ainda ta erro, ele nao consegue carregar a pagina...




Depois de um teste com a opçao de clan

apresentou esse seguinte erro:

Spoiler
Código:

Warning: include(Connection.php) [function.include]: failed to open stream: No such file or directory in C:\AppServ\www\Script\clan.php on line 9

Warning: include() [function.include]: Failed opening 'Connection.php' for inclusion (include_path='.;C:\php5\pear') in C:\AppServ\www\Script\clan.php on line 9

Warning: mysql_query() [function.mysql-query]: Can't connect to MySQL server on 'localhost' (10061) in C:\AppServ\www\Script\clan.php on line 24

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\AppServ\www\Script\clan.php on line 24

Warning: mysql_query() [function.mysql-query]: Can't connect to MySQL server on 'localhost' (10061) in C:\AppServ\www\Script\clan.php on line 29

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\AppServ\www\Script\clan.php on line 29

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\Script\clan.php on line 30




meu arquivo Clan.php esta assim:


Spoiler
Código:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="Windows-1251">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>Clans</title>
</head>
<body bgcolor="#000000" style="color:#999999; font-family:verdana;">
<?php
include("Connection.php");

$FORM2 = "<table width=500 style=\"font-size:11px; font-family:verdana; color:#999999;\" cellspacing=\"0\" cellpadding=\"0\" align=center>
<tr>
<td width=100% height=34 colspan=4 align=center class=\"content\" style=\"font-size:12px; font-family:verdana; color:#999999;\"><b>Clans</b>
</td>
</tr>
<tr>
<td style=\"font-size:12px; border:1px #999999 solid;\"><center><b>Pos</b></center></td>
<td style=\"font-size:12px; border:1px #999999 solid;\"><center><b>Clan</b></center></td>
<td style=\"font-size:12px; border:1px #999999 solid;\"><center><b>Clan Level</b></center></td>
<td style=\"font-size:12px; border:1px #999999 solid;\"><center><b>Player</b></center></td>
</tr>";


$link = mysql_query($query_chars);
$i = 1;
$activity = mysql_query("SELECT characters.char_name,characters.clanid,clan_data.clan_id,clan_data.clan_name,characters.accesslevel,clan_data.clan_level
FROM characters,clan_data
WHERE  ((characters.clanid = clan_data.clan_id) AND (characters.clanid > 0))
ORDER BY clan_data.clan_level DESC, clan_data.clan_name, characters.char_name ASC ");
while($row = mysql_fetch_array($activity))

{
 
$FORM2 .= '<tr>
    <td style=\"font-size:10px; font-family:verdana; color:#999999;\" class=content align=center>'.$style_string.$i.'</span></td>
    <td style=\"font-size:10px; font-family:verdana; color:#999999;\" class=content align=center>'.$row['clan_name'].'</td>
    <td style=\"font-size:10px; font-family:verdana; color:#999999;\" class=content align=center>'.$row['clan_level'].'</td>
        <td style=\"font-size:10px; font-family:verdana; color:#999999;\" class=content align=center>'.$row['char_name'].'</td>
  </tr>';
 
    $i++;
}
 
echo $FORM2;

?>
</body>
</html>




Meu Arquivo de conexao com banco de dados



Spoiler
Código:

[Share]Collection of PHP shares.
« on: August 10, 2009, 05:38:55 AM »
        Reply with quoteQuote
1st.5 Star rating system.

How to start?
Well first we have to make a DB and we put this inside:
Code:

    CREATE TABLE `star_vote` (
    `id` int(15) NOT NULL,
    `rating` int(10) NOT NULL default '0',
    `Voters` int(5) NOT NULL default '0',
    UNIQUE KEY(`id`)
    );

    CREATE TABLE `star_vote_ip` (
    `id` int(15) NOT NULL,
    `ip` varchar(30) NOT NULL
    );

After we created the table and added the structure inside it the next step is the next file.

You have to create a .php file name it connect.php,put inside this code:
Code:

    <?php
    define(DB_HOST, "l2batery.servegame.com");
    define(DB_USER, "root");
    define(DB_PASS, "senha do meu mysql");
    define(DB_NAME, "l2jdb");

    $conn = @mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
    @mysql_select_db(DB_NAME, $conn) or die(mysql_error());

    define(STARS, 5); // From here configure how many stars you want to have.
    ?>

After you create it config it so it can connect to DB.
Next step is create a file config.php in the file we put:

Code:

    <?php
    require "connect.php";

    $id = $_GET['id']; // we take ID;

    $display_rating = false;
    if (is_numeric($id) && $id > 0) // check if ID is numeric and if its bigger than 0
    {
    $display_rating = true;
    $vote_allow = true;

    $votes = array();

    $row = mysql_fetch_object(mysql_query("SELECT `rating`, `Voters`, COUNT(*) as 'kolko' FROM `star_vote` WHERE `id` = '$id' LIMIT 1"));
    if ($row -> How many) // Check if you've voted already with 1
    {
    $rating = @round($row -> rating / $row -> Voters); // ownring the rating in  $rating

    $votes = array_pad($votes, $rating, "starvoted.png"); // fill the massive $votes with starvoted.png(filled stars)
    $ip_vote = @mysql_result(mysql_query("SELECT COUNT(*) FROM `star_vote_ip` WHERE `id` = '$id' AND `ip` = '".$_SERVER['REMOTE_ADDR']."'"), 0);
    if ($ip_vote) $vote_allow = false; // check if you already voted with this IP
    }
    $votes = array_pad($votes, STARS, "starunvoted.png"); // fill the massive with $votes with starunvoted.png(non-filled stars)
    }
    ?>


So we're done with this file too.Now we move to the file: vote_star.js (There is nothing to change in it.)Here is it containing:

Code:

    var xmlHttp

    function vote_star(id, str)
    {
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
    alert ("Browser does not support HTTP Request")
    return
    }
    var url="vote_star.php"
    url=url "?id=" id
    url=url "&str=" str "&sid=" Math.random()
    xmlHttp.onreadystatechange=stateChanged
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
    }

    function stateChanged()
    {
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
    document.getElementById("star_votes").innerHTML=xmlHttp.responseText;
    }
    }

    function GetXmlHttpObject()
    {
    var objXMLHttp=null
    if (window.XMLHttpRequest)
    {
    objXMLHttp=new XMLHttpRequest()
    }
    else if (window.ActiveXObject)
    {
    objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
    }
    return objXMLHttp
    }


Next file we have to create is:
vote_star.php fill it with this:
Code:

    <?php
    require "connect.php";

    $id = $_GET['id'];
    $str = $_GET['str'];
    $ip = $_SERVER['REMOTE_ADDR'];

    if (is_numeric($id) && $id > 0 && in_array($str, range(1,STARS))) //
    { // if OK continue

    $votes = array();

    $row = mysql_fetch_object(mysql_query("SELECT `rating`, `Voters`, COUNT(*) as 'kolko' FROM `star_vote` WHERE `id` = '$id' LIMIT 1"));
    if ($row -> kolko) // check if its already voted with this ID
    { // ??? ? ?????????
    $ip_vote = @mysql_result(mysql_query("SELECT COUNT(*) FROM `star_vote_ip` WHERE `id` = '$id' AND `ip` = '$ip'"), 0);

    if (!$ip_vote) // check if its already voted with this IP if no continue
    {
    $new_rating = $row -> rating  $str; // add the new vote rating to the old
    $new_Voters = $row -> Voters  1; // add  1 to voters

    $rating = @round($new_rating / $new_Voters); // calculate middle rating
    $votes = array_pad($votes, $rating, "starvoted.png"); // fill $votes with starvoted.png(filled stars)

    mysql_query("UPDATE `star_vote` SET `rating` = '$new_rating',`Voters` = '$new_Voters' WHERE `id` = '$id'"); // update the info for the ID
    mysql_query("INSERT INTO `star_vote_ip` (`id`,`ip`) VALUES ('$id','$ip')"); // log the IP of the voter
    }
    }
    else // ??? ??? ??? ????? ?? ? ??? ???????? ?? ???? ID
    {
    $rating = $str;
    $votes = array_pad($votes, $rating, "starvoted.png"); // fill the massive  $votes with starvoted.png(filled stars)

    mysql_query("INSERT INTO `star_vote` (`id`, `rating`, `Voters`) VALUES ('$id', '$str', '1')"); // creating new ID with the vote
    mysql_query("INSERT INTO `star_vote_ip` (`id`,`ip`) VALUES ('$id','$ip')"); // log the IP of the voter
    }

    $votes = array_pad($votes, STARS, "starunvoted.png"); // fill the massive $votes with starunvoted.png(empty stars)

    if ($rating)
    {
    for ($i=0;$i<STARS;$i  )
    echo "<img src="".$votes[$i]."" border="0">";
    }
    }
    ?>


The final step is create a file ex. index.php put this inside it:
Code:

    <?php
    require "config.php";
    ?>
    <html>
    <head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>Demo Vote system by: Flower</title>
    <?php
    if ($display_rating)
    {
    ?>
    <script src="vote_star.js" type="text/javascript"></script>
    <script type="text/javascript">
    function star_vote(id)
    {
    for (i=1;i<=<?=STARS?>;i  )
    {
    if (i <= id)
    {
    document[i].src="starvoted.png";
    }
    else
    {
    document[i].src="starunvoted.png";
    }
    }
    }
    function normal()
    {
    <?php
    for ($i=0,$i2=1;$i<STARS;$i  ,$i2  )
    {
    echo "document[$i2].src="".$votes[$i]."";n";
    }
    ?>
    }
    </script>
    <?php
    }
    ?>
    </head>
    <body>

    <?php
    if ($display_rating)
    {
    ?>
    <b>Voters:</b>
    <div id="star_votes">
    <?php
    for ($i=0,$i2=1;$i<STARS;$i  ,$i2  )
    {
    ?>
    <?php if ($vote_allow) { ?><a href="javascript:void(null)" onMouseOver="star_vote('<?=$i2?>')" onMouseOut="normal()" onClick="vote_star('<?=$id?>', '<?=$i2?>')"><?php } ?><img id="<?=$i2?>" src="<?=$votes[$i]?>" border="0"><?php if ($vote_allow) { ?></a><?php }
    }
    ?>
    </div>
    <?php
    }
    else echo "<b>Invalid ID!</b>";
    ?>

    </body>
    </html>


How to use it?Open an index.php and put
Code:

?id=[ ID]

Each ID is individual and the rates are invidual for each ID.

----------------------

2.Creating DB with PHP.

The PHP Function "mydql_create_db() tries to create a DB with the name,which u add as argument.The guide down here shows all exsisting DB and after that creates a form,in which you can add the name of the new BD.When the form get accepted,the script tries to create the new BD with the given name.

Code:

<?php
$conn = @mysql_connect("localhost", "test", "test")
or die( "Error, the connection to MySQL cannot be accomplished." );
$rezl = @mysql_create__db ( $_REQUEST['db'] );
$rez2 = @mysql_list_dbs($conn);
$spisyk = "";
for( $row=0; $row < mysql_num_rows( $rez2 ); $row  )
{ $spisyk .= raysql_tablename( $rez2, $row ) .
" - "; }
?>


and

Code:

<html>
<head> <title>Create DB with PHP by: Flower</title> </head>
<body>
<form action="<?php echo( $_SERVER['PHP_SELF'] ); ?> " method="post">
Data base: <?php echo( $spisyk ); ?> <hr>
Name:<input type = "text" name = "db"> <br>
<input type = "submit" value = "Create DB.">
</form>
</body>
</html>



P.S2.:If you have any problem use prefix: [Problem] Include full explaination of the problem.If you find a bug write here.Haven't tested it just created it i think there are no bugs inside it!Enjoy!

Keep the topic clean!All useless posts will be deleted without warns!


Setokaiba 15-08-2009 06:55 PM

Warning: include(Connection.php) [function.include]: failed to open stream: No such file or directory in C:\AppServ\www\Script\clan.php on line 9

Este erro significa que não foi encontrado o arquivo no diretório C:\AppServ\www\Script\

Warning: include() [function.include]: Failed opening 'Connection.php' for inclusion (include_path='.;C:\php5\pear') in C:\AppServ\www\Script\clan.php on line 9

Este erro significa que não foi encontrado o path, normal já que não foi encontrado o arquivo acima.

Warning: mysql_query() [function.mysql-query]: Can't connect to MySQL server on 'localhost' (10061) in C:\AppServ\www\Script\clan.php on line 24

Neste aqui significa que o script não conseguiu se conectar com o seu banco de dados.

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\AppServ\www\Script\clan.php on line 24

Os demais erros são decorrentes do anterior.

Warning: mysql_query() [function.mysql-query]: Can't connect to MySQL server on 'localhost' (10061) in C:\AppServ\www\Script\clan.php on line 29

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\AppServ\www\Script\clan.php on line 29

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\Script\clan.php on line 30

Misho 15-08-2009 07:04 PM

Seto me diz nao tem nenhum site aqui na SE que tem esses Scrips prontos?

apenas para eu retirar e por na minha pasta WWW?

ja que ja mechi em tudo que podia, ate testei outros Scrip e apresento outro errou agora:

Citação:

VOLTAR
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'l2alive.servegame.com' (10061) in C:\AppServ\www\status\config.php on line 6
Can't connect to MySQL server on 'l2meuserver.servegame.com' (10061)



Seto essa parte que ele diz nao achar o arquivo, esta errado, por que o arquivo esta na pasta certa

C:\AppServ\www\Script

Dentro tem o arquivo clan.php normal

Config.php desses Scrip ta assim:

Citação:

<?
$servidor = "l2Meuserver.servegame.com";
$usuario = "root";
$senha = "senha MySql";
$banco = "l2jdb";
$conexao = mysql_connect($servidor, $usuario, $senha) or die(mysql_error());
mysql_select_db($banco, $conexao) or die(mysql_error());
?>

Setokaiba 15-08-2009 07:22 PM

Você tem que configurar corretamente os dados senão nunca conecta a database pra realizar a consulta e mostrar os resultados.

l2batery.servegame.com
l2alive.servegame.com

Afinal de contas qual é o teu?

E se o site estiver no mesmo computador que o servidor, deve usar localhost e não o ddns.

Misho 15-08-2009 07:56 PM

eu testei meus 2 no-ip, o site to usando pra mecher nele no PC, mas ja mandei pro meu HOST e tbem aconteceu a mesma coisa...


Eu acesso ele via [Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar] as portas que usei, so da erro nisso ai

Setokaiba 15-08-2009 08:23 PM

Seguinte, tu tem que por o caminho do No-IP ou do DDNS aí, sem esse negócio de :8090

8090 é uma porta alternativa para web sites.
O que o código pede é o host de onde fica a database para realizar uma consulta ao banco de dados e gerar as informações que os códigos pedem, independente que seja para o web site ou não, ele vai tentar encontrar a porta 3306 que é a default do MySQL.
Certifique-se de que o firewall está desativado e com essa exceção de acesso a porta 3306.

Misho 15-08-2009 09:06 PM

Seto rodei novamente no PC e rsolvi, pelo jeito era algum erro no meu MYSQL,

reinstalei ele, mas a duvida que vc me disse la em cima mas nao consegui resolver foi a seguinte duvida:

Quando clico nos TOP eles abrem a apgina nova em cima da pagina atual, queria que fosse aberto 1 pagina nova

Tipo dessa pagina

[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]


Olha que ele abre uma mini janela mostrando, ate poderia ser na mesma pagina minha,no meio dela...

gustavohp 15-08-2009 09:26 PM

Amigo Vc usa o DreamWeaver?
Se usar, abre a pagina que tem o link que direciona para o seus tops e clica nele, ai vc procura la embaixo no dreamweaver a opção Target, ai eh so vc escolher a opção _blank , que abrira em uma aba ou em uma nova janela

Um Exemplo pra vc ve como faz
[Somente Usuários Registrados Podem Visualizar os Links Desta PáginaClique aqui para se Registrar]


Se Ajudei Clique em Obrigado ^^


Horários baseados na GMT -3. Agora são 11:29 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.