je vais mettre le code ca sera plus simple ^^
ensuite pour la version de MySQL euuuuh disons la derniere ^^
en fait je vais devoir faire un serveur ftp pour permettre aux gens de consulter
fichier L2DP.php
<?php
function l2dp_header()
{
global $l2dp_lang;
if ( isset( $_GET['language'] ) )
{
setcookie( 'language', '', time()-3600, '/' );
setcookie( 'language', $_GET['language'], time()+3600*24*30, '/' );
$l2dp_lang = $_GET['language'];
}
else
{
if ( ( isset( $_COOKIE['language'] ) )
&& ( strlen( $_COOKIE['language'] ) == 2 ) )
{
$l2dp_lang = $_COOKIE['language'];
}
else
{
setcookie( 'language', '', time()-3600, '/' );
setcookie( 'language', 'en', time()+3600*24*30, '/' );
$l2dp_lang = 'en';
}
}
echo <<<EOD
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="l2dp.css" rel="stylesheet" type="text/css"/>
EOD;
}
function l2dp_body()
{
echo "</head>\n";
echo "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\"";
echo " vlink=\"#FF00FF\" alink=\"#FF0000\">\n";
if ( strstr( $_SERVER['REQUEST_URI'], '?' ) )
{
$base = $_SERVER['REQUEST_URI'] . '&';
}
else
{
$base = $_SERVER['REQUEST_URI'] . '?';
}
echo "<table border=0 width=100%><tr><td>";
echo "<a href=\"index.php\">[home]</a>";
echo "<td align=right><a href=\"" . $base . "language=en\">English</a> - ";
echo "<a href=\"" . $base . "language=kr\">Korean</a> - ";
echo "<a href=\"" . $base . "language=jp\">Japanese</a> - ";
echo "<a href=\"" . $base . "language=tw\">Taiwan</a> - ";
echo "<a href=\"" . $base . "language=cn\">China</a></td></tr><table><br>\n";
echo "<table width=740 border=0 cellpadding=0 cellspacing=0>";
echo "<tr><td width=\"100%\">\n\n";
}
function l2dp_footer()
{
echo "</td></tr></table><p>"
. "<a href=\"http://www.mithral.com/~beberg/L2DP/\">L2DP</a> data from "
. gmdate('Y-M-d H:i:s \U\T\C', time() ) . "</p>\n";
echo "</body></html>";
}
function l2dp_connect( $database )
{
// PostgreSQL version
return pg_connect( "host=localhost user=username dbname=$database" );
// MySQL version
//$c = mysql_connect( "localhost", "user", "password" );
//mysql_select_db( $database );
//return $c;
}
function l2dp_disconnect( $db_conn )
{
pg_close( $db_conn );
}
?>
Fichier armor.php
<?php
require 'L2DP.php';
l2dp_header();
echo "<title>L2DP - Armor</title>";
l2dp_body();
$dbc = l2dp_connect( "lineage2" );
$type = $_REQUEST['type'];
if ( $type == "" )
{
$type = "chest";
}
switch ( $type )
{
case 'chest':
case 'legs':
case 'fullbody':
case 'pet':
$print_type = "body";
break;
case 'feet':
case 'gloves':
case 'head':
case 'back':
case 'underwear':
$print_type = "armor";
break;
case 'ear':
case 'neck':
case 'finger':
$print_type = "mdef";
break;
case 'shields':
$print_type = "shield";
break;
}
if ( $type == "pet" )
{
$sql = "SELECT A.crystallizable, UPPER(A.crystal_type) as crystal_type,
A.crystal_count, A.armor_type, A.physical_defense, A.magical_defense,
A.mp_bonus, I.id, I.icon, I.weight, I.price, N.name, N.description
FROM Armor as A
JOIN Items as I
ON ( A.body_part = 'chest' AND I.icon LIKE '%pet%' AND I.id = A.id )
LEFT JOIN ItemNames as N
ON ( I.id = N.id AND N.language = '$l2dp_lang' )
ORDER BY A.armor_type, A.physical_defense, A.magical_defense;";
}
else if ( $print_type == "shield" )
{
$sql = "SELECT W.crystallizable, UPPER(W.crystal_type) as crystal_type,
W.crystal_count, W.shield_defense, I.id, I.icon, I.weight, I.price,
N.name, N.description
FROM Weapons as W
JOIN Items as I
ON ( W.hands = 'shield' AND I.id = W.id )
LEFT JOIN ItemNames as N
ON ( I.id = N.id AND N.language = '$l2dp_lang' )
ORDER BY W.shield_defense";
}
else
{
$sql = "SELECT A.crystallizable, UPPER(A.crystal_type) as crystal_type,
A.crystal_count, A.armor_type, A.physical_defense, A.magical_defense,
A.mp_bonus, I.id, I.icon, I.weight, I.price, N.name, N.description
FROM Armor as A
JOIN Items as I
ON ( A.body_part = '$type' AND I.icon NOT LIKE '%pet%' AND I.id = A.id )
LEFT JOIN ItemNames as N
ON ( I.id = N.id AND N.language = '$l2dp_lang' )
ORDER BY A.armor_type, A.physical_defense, A.magical_defense;";
}
//echo "<pre>" . $sql . "</pre>";
$result = pg_query( $dbc, $sql );
echo "<table border=1 cellpadding=3 cellspacing=0 width=\"100%\">";
echo "<tr><th colspan=2>Name";
echo "<th>Class";
switch ( $print_type )
{
case "body":
echo "<th>Type";
echo "<th>P.DEF";
echo "<th>MP";
break;
case "armor":
case "shield":
echo "<th>P.DEF";
break;
case "mdef":
echo "<th>M.DEF";
break;
}
echo "<th>Weight";
echo "<th>Price</tr>";
while ( $item = pg_fetch_array( $result ) )
{
echo "<tr>";
if ( $item['icon'] == "" )
{
echo "<td align=\"center\">-</td>";
}
else
{
echo "<td valign=\"center\" align=\"center\" width=\"32\">"
. "<img src=\"images/"
. $item['icon'] . "\" width=\"32\" height=\"32\" alt=\""
. $item['id'] . "\"></td>";
}
echo '<td><b>'
. '<a href="item.php?id=' . $item['id'] . '">'
. $item['name'] . '</a>' . '</b><br><font size="-2">'
. $item['description'] . '</td>';
$class = ( $item['crystal_type'] == "NONE" )
? " " : $item['crystal_type'];
$crys = ( $item['crystallizable'] )
? " (" . $item['crystal_count'] . ")" : "";
echo "<td>" . $class . $crys . "</td>";
switch ( $print_type )
{
case "body":
echo "<td align=right>" . $item['armor_type'] . "</td>";
echo "<td align=right>" . $item['physical_defense'] . "</td>";
echo "<td align=right>" . $item['mp_bonus'] . "</td>";
break;
case "armor":
echo "<td align=right>" . $item['physical_defense'] . "</td>";
break;
case "shield":
echo "<td align=right>" . $item['shield_defense'] . "</td>";
break;
case "mdef":
echo "<td align=right>" . $item['magical_defense'] . "</td>";
break;
}
echo "<td align=right> " . $item['weight'] . "</td>";
echo "<td align=right> " . number_format($item['price']) . "</td></tr>\n";
}
echo "</table>";
l2dp_disconnect( $dbc );
l2dp_footer();
?>
-------------------------------------------------------------------------------------------------------
Il vaut mieux poser une question et passer pour bête que le rester toute sa vie