Jump to content
  • 0

please help Pws na sindesetai ena ton server sas me to site sas


Question

Posted

#erw ta panta apo l2 3erw na ftiaxnw server kai alla mono 1 pragma dn exw ma8ei akoma.. Pws na sindesw ton site m me tin database tou server.. PX ama 8elw na ftia3w top 100 kai tetia 3eretai..Ftiaxnw ena site aplo kai ftiaxnw ena neo block pou na legetai top 10 meta pws to sindew??? 3erw oti to sindew me php series kai tetia alla akrivos dn 3erw ti na grapsw... Ama 3erei kapios na me voi8isei.... :-\

1 answer to this question

Recommended Posts

  • 0
Posted

Δεν ξέρω πολύ καλα php γιατι δεν ασχολούμε πολυ με sites αλλα κάτι τετοιο νομίζω θα σε βοηθήσει..χωρίς να βάζω ομως τ χερι μ στ φωτια.

<?php
//---------CONFIGS---------//
$title="Title here";  // Page Title Here
$type="1"; //Type 1 for Top PvP or 2 for Top PK
$server="localhost"; // MySQL IP
$user="root"; //MySQL Username
$password=""; //MySQL Password
$database="l2jdb"; //MySQL Database
$top="10"; //Number of top PvP/PK Players
//-----END OF CONFIGS-----//
if ($title) {
print("<head><title>$title</title></head>");
}
else {
print("<head><title>No Page Title</title></head>");
}
mysql_connect("$server", "$user", "$password") or die(mysql_error());
mysql_select_db("$database") or die(mysql_error());

if($type == '1'){
$result = mysql_query("SELECT char_name,pvpkills FROM characters where pvpkills>0 and accesslevel=0 order by pvpkills desc") 
or die(mysql_error());  
echo "<center><h3>Top $top PvP Players</h3></center><table border=1 align=center><tr> <th>Character</th> <th>PvP Kills</th> </tr>";
$sum1=0;
while($row = mysql_fetch_array( $result )) {
	$name = $row['char_name'];
	$kills = $row['pvpkills'];
	if ($sum1<$top) {
	echo "<tr><td align=center>$name</td><td align=center>$kills</td></tr>"; 
	$sum1++;
	}
} 
}
elseif($type == '2'){
$result2 = mysql_query("SELECT char_name,pkkills FROM characters where pkkills>0 and accesslevel=0 order by pkkills desc") 
or die(mysql_error());  
echo "<center><h3>Top $top PK Players</h3></center><table border=1 align=center><tr> <th>Character</th> <th>PK Kills</th> </tr>";
$sum2=0;
while($row2 = mysql_fetch_array( $result2 )) {
	$name2 = $row2['char_name'];
	$kills2 = $row2['pkkills'];
	if ($sum2<$top) {
	echo "<tr><td align=center>$name2</td><td align=center>$kills2</td></tr>"; 
	$sum2++;
	}
} 
}
else {
echo "<center>Please config the variable $type. Make it <b>1</b> for Top PvP or <b>2</b> for Top PK.</center>";
}
?>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...