Descriere: Accesand un membru din clasamentul propriu al serverului, va afisa date de profil ale jucatorului ales.

 

Cautam linia din scriptul clasamentului( este posibil sa difere putin de la site la site, poate culoarea, dimensioneaza etc) :

 

 

 

COD: SELECTAŢI TOT

 


<td width=”100″><font color=”black”>” . $array[„name”] . „</font></th>

 

 

 

 

Repunem cu:

 

 

COD: SELECTAŢI TOT



<td width=”100″><font color=”black”><a href=”?s=player&char=”,$array[„name”],””>”,$array[„name”],”</a></font></th>

 

 

 

Avem nevoie de un fisier PHP ce contine sintaxe cu date de profil. Fisierul „player.php” trebuie sa fie pus in locatia unde se afla si fisierul clasamentului. Cream urmatorul fisier in format PHP:

 

 

 

 

 

 

 


<?php
session_start();
$char = $_GET[‘char’];
include ‘inc/dbsettings.php';
$db = „player”;
mysql_connect($dbhost, $dbuser, $dbpw) OR
die(„ERROR: Connection failed. „.mysql_error());
mysql_select_db($db) OR
die(„ERROR: DB allready open. „.mysql_error());
$sql = „SELECT * FROM player WHERE name LIKE ‘$char’”;
$ergebnis = mysql_query($sql);
$row = mysql_fetch_object($ergebnis);
$lvl = $row->level;
$skillgroup = $row->skill_group;
$class = $row->job;
$onlinemin = $row->playtime;
$exp = $row->exp;
$levelstep = $row->level_step;
$name = $row->name;
$horse_level = $row->horse_level;
$name = $row->name;
$part_main = $row->part_main;
$name = $row->name;
$gold = $row->gold;


echo ”
</td><td><table width=’240′>
<tr>
<td width=”50%”><b>&nbsp;Nume caracter </b></td><td>”. $name.”</td>
</tr>
<tr>
<td width=”50%”><b>&nbsp;Nivel </b></td><td>”. $lvl.”</td>
</tr>
<tr>
<td width=”50%”><b>&nbsp;Timp jucat </b></td><td>”. $onlinemin .”min</td>
</tr>
<tr>
<td width=”50%”><b>&nbsp;Experienta </b></td><td>”. $exp .”</td>
</tr>
<tr>
<td width=”50%”><b>&nbsp;Progres nivel </b></td><td> „,$levelstep,”/4 sfere</td>
</tr>
<tr>
<td width=”50%”><b>&nbsp;Suma Yang </b></td><td>”. $gold .”</td>
</tr>
<tr>
<td width=”50%”><b>&nbsp;Nivel cal </b></td><td> „,$horse_level,”</td>
</tr>
<tr>
<td width=”50%”><b>&nbsp;Sex </b></td><td>


„;


if($class == „0” or $class == „2” or $class == „5” or $class == „7” and $class != „0”)
{
echo „Masculin”;
}
else
{
echo „Feminin”;
}
echo „</td>
</tr>
<tr>
<td width=”50%”><b>&nbsp;Rasa/Invatatura </b></td><td> „;
if($class == „0” or $class == „4”)
{
if($skillgroup == „1” and $skillgroup !=”0″)
{
echo „Razboinic/Corp „;
}
elseif($skillgroup == „2” and $skillgroup !=”0″)
{
echo „Razboinic/Mental „;
}
elseif($skillgroup == „0”)
{
echo „Fara magie”;
}
}
elseif($class == „1” or $class == „5”)
{
if($skillgroup == „1” and $skillgroup !=”0″)
{
echo „Ninja/Lama „;
}
elseif($skillgroup == „2” and $skillgroup !=”0″)
{
echo „Ninja/Arcas „;
}
elseif($skillgroup == „0”)
{
echo „Fara magie</small>”;
}
}
elseif($class == „2” or $class == „6”)
{
if($skillgroup == „1” and $skillgroup !=”0″)
{
echo „Sura/Arme”;
}
elseif($skillgroup == „2” and $skillgroup !=”0″)
{
echo „Sura/Magie neagra”;
}
elseif($skillgroup == „0”)
{
echo „Fara magie”;
}
}
elseif($class == „3” or $class == „7”)
{
if($skillgroup == „1” and $skillgroup !=”0″)
{
echo „Saman/Dragon „;
}
elseif($skillgroup == „2” and $skillgroup !=”0″)
{
echo „Saman/Lighting”;
}
elseif($skillgroup == „0”)
{
echo „Fara magie”;
}


}
else
{
echo „garnix”;
}
echo „</td>
</tr>
</table>
</td></tr>
</table>
„;


?>

 

 

 

 

 

La fisierul PHP ce contine datele de profil, exista urmatoarea linie:

 

 

 

 


include ‘inc/dbsettings.php';

 

 

 

 

In mare parte HomePageurile voastre detin folderul „inc” ce contin fisiere de legatura pentru conectare baza de date.

In cazul nostru e vorba de urmatorul script „dbsettings.php” ce va trebuii sa faceti legatura la el din scriptul „player”, sau puteti sa faceti singuri legatura potrivindu-se cu siteul.

 

 

 

 

 


<?php
$serverip = ‘TRECE IP';
$dbhost = ‘TRECE IAR IP';
$dbuser = ‘root';
$dbpw = ‘PAROLA BAZA DE DATE';
?>

 

Daca doriti sa va modificati afisarea profilului dupa bunul plac, o puteti face schimband informatii din fisierul „player.php” sau orice nume i-ati da.

 

Pentru a adauga noi date in profil, nu trebuie decat sa accesati navicat tabelul „player” si sa urmariti numele coloanei si sa o inserati ulterior in script.