guild mark > html code (php code)/Modules
:: Gamer :: Online Games :: Всичко за MuOnline
Страница 1 от 1
guild mark > html code (php code)/Modules
I kinda prefer html over gd2. So here is the function that should ease up the converting of guild logos to a regular display in your web page.
Note that this works with all php versions and does not require the gd2 php extension to be loaded( it has performance issues it is bigger in output size )
so i've created this little php function that should do the job and decided to share it
Create a file in your web root called sy_mark.php (for example) and fill the following code in it
Note that the code is well commented ^^
PHP Code:
/*
[ "MuMark to HTML" Script]
[ Author: Savoy]
[ savoy___@hotmail.com]
*/
// Create the function
function SYlogo($code,$xy=3) {
// Turn hex into dec
$code = urlencode(bin2hex($code));
$color[0] = ''; $color[1]='#000000'; $color[2]='#8c8a8d'; $color[3]='#ffffff'; $color[4]='#fe0000'; $color[5]='#ff8a00'; $color[6]='#ffff00'; $color[7]='#8cff01'; $color[8]='#00ff00'; $color[9]='#01ff8d'; $color['a']='#00ffff'; $color['b']='#008aff'; $color['c']='#0000fe'; $color['d']='#8c00ff'; $color['e']='#ff00fe'; $color['f']='#ff008c';
// Set the default zero position.
$i = 0;
$ii = 0;
// Create the table
$it = '';
// Start the logo drawing cycle for each color slot
while ($i<64) {
// Get the slot color number
$place = $code{$i};
// Increase the slot
$i ;$ii ;
// Get the color of the slot
$add = $color[$place];
// Create the slot with its color
$it .= '';
// In case we have a new line
if ($ii== {
$it .= '';
if ($ii != 64) $it .='';
$ii =0;
}
}
// Finish the table off
$it .= '
';
// What do we output
return $it;
}
?>
How to use ? Its easy ..
just write down this in a file to test
PHP Code:
// Connect to database bullcrap - fill it in
require 'sy_mark.php';
$guild = 'TestGuildName'; // Change this to your guild name
// Using a regular query
$query = mssql_query("select [G_Mark] from [Guild] where [G_Name]='".$guild."'");
// Fetching the results as a dec array
$result = mssql_fetch_row($query);
// Fetching the first (& only) result - g_mark
$glogo = $result[0];
// Set a variable with the output text
$mylogo = SYlogo($glogo,3); // You can change 3 with the size (in pixels) you want each slot to have
// You want to display it ???
print $mylogo;
?>
*Tested and working, don't bother to post if you can't get it working - i've explained as well as i can*
Note that this works with all php versions and does not require the gd2 php extension to be loaded( it has performance issues it is bigger in output size )
so i've created this little php function that should do the job and decided to share it
Create a file in your web root called sy_mark.php (for example) and fill the following code in it
Note that the code is well commented ^^
PHP Code:
/*
[ "MuMark to HTML" Script]
[ Author: Savoy]
[ savoy___@hotmail.com]
*/
// Create the function
function SYlogo($code,$xy=3) {
// Turn hex into dec
$code = urlencode(bin2hex($code));
$color[0] = ''; $color[1]='#000000'; $color[2]='#8c8a8d'; $color[3]='#ffffff'; $color[4]='#fe0000'; $color[5]='#ff8a00'; $color[6]='#ffff00'; $color[7]='#8cff01'; $color[8]='#00ff00'; $color[9]='#01ff8d'; $color['a']='#00ffff'; $color['b']='#008aff'; $color['c']='#0000fe'; $color['d']='#8c00ff'; $color['e']='#ff00fe'; $color['f']='#ff008c';
// Set the default zero position.
$i = 0;
$ii = 0;
// Create the table
$it = '';
// Start the logo drawing cycle for each color slot
while ($i<64) {
// Get the slot color number
$place = $code{$i};
// Increase the slot
$i ;$ii ;
// Get the color of the slot
$add = $color[$place];
// Create the slot with its color
$it .= '';
// In case we have a new line
if ($ii== {
$it .= '';
if ($ii != 64) $it .='';
$ii =0;
}
}
// Finish the table off
$it .= '
// What do we output
return $it;
}
?>
How to use ? Its easy ..
just write down this in a file to test
PHP Code:
// Connect to database bullcrap - fill it in
require 'sy_mark.php';
$guild = 'TestGuildName'; // Change this to your guild name
// Using a regular query
$query = mssql_query("select [G_Mark] from [Guild] where [G_Name]='".$guild."'");
// Fetching the results as a dec array
$result = mssql_fetch_row($query);
// Fetching the first (& only) result - g_mark
$glogo = $result[0];
// Set a variable with the output text
$mylogo = SYlogo($glogo,3); // You can change 3 with the size (in pixels) you want each slot to have
// You want to display it ???
print $mylogo;
?>
*Tested and working, don't bother to post if you can't get it working - i've explained as well as i can*
Similar topics
» Какво е Guild, и как да си направя Guild ? Ако имате някакви проблеми относно сървъра, форума, сайта. Пишете в този раздел и ще се помъчим да ви помогонем.
» Top Online Players /Modules
» Anti proxy script /Modules
» Top Online Players /Modules
» Anti proxy script /Modules
:: Gamer :: Online Games :: Всичко за MuOnline
Страница 1 от 1
Права за този форум:
Не Можете да отговаряте на темите
|
|
Пон 19 Ное 2018, 00:01 by paynerr
» LockMU Season 6 Episode 3
Пон 12 Ное 2018, 20:02 by kaleikata
» DawnMu старата школа за старите играчи
Съб 26 Ное 2016, 01:13 by besnia3
» [AD] OPEN MU SEASON 3 EPISODE 1
Съб 09 Апр 2016, 06:29 by xtasy
» [AD] OPEN MU SEASON 3 EPISODE 1
Чет 07 Яну 2016, 10:11 by xtasy
» WarWorldMu 97d99i Exp: 200x Drop: 80%
Нед 16 Авг 2015, 20:20 by StrongHold
» LinkosMU Season 3 episode 1
Чет 14 Май 2015, 23:51 by StrongHold
» HARD MU (99b+)
Чет 16 Апр 2015, 16:23 by roly92
» [AD] OpenMu S3 , EP 1 max xp , fun server
Чет 26 Мар 2015, 16:14 by rogue93