Mu Online Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Mu Online Forum

This is Forum For Mu Online
 
ИндексИндекс  Последни снимкиПоследни снимки  ТърсенеТърсене  Регистрирайте сеРегистрирайте се  ВходВход  

 

 guild mark > html code (php code)

Go down 
АвторСъобщение
FunnyMaster
Admin



Брой мнения : 198
Join date : 20.11.2010

guild mark > html code (php code) Empty
ПисанеЗаглавие: guild mark > html code (php code)   guild mark > html code (php code) Icon_minitimeНед Ное 21, 2010 1:33 am

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:
<?php
/*

[ "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 = '<table style='width: '.(8*$xy).'px;height:'.(8*$xy).'px' border=0 cellpadding=0 cellspacing=0><tr>';

// 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 .= '<td class='guildlogo' style='background-color: '.$add.';' width=''.$xy.'' height=''.$xy.''></td>';

// In case we have a new line
if ($ii==Cool {
$it .= '</tr>';
if ($ii != 64) $it .='<tr>';
$ii =0;
}
}

// Finish the table off
$it .= '</table>';

// What do we output
return $it;
}
?>
How to use ? Its easy ..
just write down this in a file to test
PHP Code:
<?php
// 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*
Върнете се в началото Go down
https://mubg.all-up.com
 
guild mark > html code (php code)
Върнете се в началото 
Страница 1 от 1
 Similar topics
-
» SQL Code to DELETE inactive accounts
» [Code / Script] Sql Script [Auto PK Clear]

Права за този форум:Не Можете да отговаряте на темите
Mu Online Forum :: Mu Online :: Sourse :: MuWebs :: Modules-
Идете на: