- Joined
- Nov 23, 2008
- Messages
- 644
- Reaction score
- 572
Нека кажа, че тук съм писал само един от файловете това е този който визуализира гилдиите.
Първият файл е guild.php
binhex.php в modules/
guildznak.php в Modules/
conreal.php в главната директория.
Демо на картинка.
Първият файл е guild.php
PHP:
<?php
include "modules/binhex.php";
include "conreal.php";
?>
<center><font color="#FFFFFF">
<table width="370" border="0" class="news" cellspacing="0" cellpadding="0">
<tr>
<td class="new" colspan="7">Top 100 Guilds</td>
</tr>
<tr>
<tr>
<td width="25%" class="nes">Name</td>
<td width="25%" class="nes">Points</td>
<td width="25%" class="nes">Creator</td>
<td width="25%" class="nes">Players</td>
</tr>
<td class="new1" valign="top">
<?php
$query = mssql_query("Select TOP 100 * from Guild ORDER BY G_Score DESC");
while($a=mssql_fetch_array($query))
{
$mark1=$a['G_Mark'];
$hex=bin2hex($mark1);
$mark=$a['G_Name'];
echo "<img src='modules/guildznak.php?string=$hex&skala=1.6'> $mark<br>";
}
?>
</td>
<td class="new1" valign="top">
<?php
$query = mssql_query("Select TOP 100 * from Guild ORDER BY G_Score DESC");
while($a=mssql_fetch_array($query))
{
$mark=$a['G_Score'];
if ($mark==NULL)
{
$mark="0";
}
echo "$mark<br>";
}
?>
</td>
<td class="new1" valign="top">
<?php
$query = mssql_query("Select TOP 100 * from Guild ORDER BY G_Score DESC");
while($a=mssql_fetch_array($query))
{
$mark=$a['G_Master'];
echo "$mark<br>";
}
?>
</td>
<td class="new1" valign="top">
<?php
$query = mssql_query("Select TOP 100 * from Guild ORDER BY G_Score DESC");
while($a=mssql_fetch_array($query))
{
$mark=$a['G_Name'];
$select=mssql_num_rows(mssql_query("SELECT * from GuildMember where G_Name='$mark'"));
echo "$select<br>";
}
?>
</td>
</tr>
</table>
</font></center>
binhex.php в modules/
PHP:
<?php
function hex2bin($h)
{
if (!is_string($h)) return null;
$r='';
for ($a=0; $a<strlen($h); $a+=2) { $r.=chr(hexdec($h{$a}.$h{($a+1)})); }
return $r;
}
?>
guildznak.php в Modules/
PHP:
<?php
/*-----------------------------------------------------*\
| SkyTeam MuPage file |
| this file is connected with module $page["glidie"] |
| File version 1.1 |
| > 1.1 - Now display transparent background if set |
| by Amelek ([email protected]) |
| http://lorencia.com |
\*-----------------------------------------------------*/
$string = $_GET['string'];
$skala = $_GET['skala'];
if(isset($string) AND isset($skala))
{
$a=-1;
if($skala > 10)
$skala = 10;
$isize=$skala*8;
$img = imagecreate($isize,$isize);
$bgcol = imagecolorallocate($img,5,5,5);
imagecolortransparent($img,$bgcol);
//imagefill($img,0,0,$bgcol);
$kolory = array(
0 => imagecolorallocate($img,5,5,5),
1 => imagecolorallocate($img,0,0,0),
2 => imagecolorallocate($img,138,138,138),
3 => imagecolorallocate($img,255,255,255),
4 => imagecolorallocate($img,255,0,0),
5 => imagecolorallocate($img,255,135,4),
6 => imagecolorallocate($img,255,254,0),
7 => imagecolorallocate($img,134,255,0),
8 => imagecolorallocate($img,0,255,0),
9 => imagecolorallocate($img,0,255,139),
'a' => imagecolorallocate($img,0,255,255),
'b' => imagecolorallocate($img,0,134,255),
'c' => imagecolorallocate($img,0,0,255),
'd' => imagecolorallocate($img,136,0,255),
'e' => imagecolorallocate($img,255,0,255),
'f' => imagecolorallocate($img,255,0,135)
);
for($i=0; $i<64; $i=$i+1)
{
if($i%8 == 0)
$a=$a+1;
$c=$i%8;
$chr=substr ($string, $i, 1);
$posx=$c*$skala;
$posy=$a*$skala;
$posxa=$posx+$skala;
$posya=$posy+$skala;
if($chr != '0')
{
$linecol = $kolory[$chr];
imagefilledrectangle($img,$posx,$posy,$posxa,$posya,$linecol);
}
}
$linecol = imagecolorallocate($img,0,0,0);
imagerectangle($img,0,0,($isize-1),($isize-1),$linecol);
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
}
?>
conreal.php в главната директория.
PHP:
<?php
$conn=mssql_connect('localhsot','sa','password');
$selected=mssql_select_db('MuOnline', $conn);
?>
Демо на картинка.