• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PHP] Character Signature - v4

DON'T use it at the same time with the Gesior lay-out. It will bug like this.

You can try putting it in a new folder, make one in xampp/htdocs/

Name it whatever you want, maybe like xampp/htdocs/signatures/

Put the script to there and then link it like this:

<a href="yoursite.com/signatures/signature.php"></a>

or whatever you made it to.
 
Code:
Obrazek "http://localhost/index.php?subtopic=sygnatura" nie może zostać wyświetlony, ponieważ zawiera błędy.

I have got this error /\
English:
Code:
Image "http://localhost/index.php?subtopic=sygnatura" can not be showed, becouse its got errors.

Or somethink like thats. My english its not so good ^_^
 
Code:
Obrazek "http://localhost/index.php?subtopic=sygnatura" nie może zostać wyświetlony, ponieważ zawiera błędy.

I have got this error /\
English:
Code:
Image "http://localhost/index.php?subtopic=sygnatura" can not be showed, becouse its got errors.

Or somethink like thats. My english its not so good ^_^

I don't know why i can't edit my post...

Code:
C:\xampp\htdocs\index.php :

Code:
case "sygnatura";
		$subtopic = "Stwórz Sygnature";
		$topic = "Stwórz Sygnature";
		include("Sygnatura.php");
	break;

Code:
C:\xampp\htdocs\sygnatura.php :

Code:
<?php

    $config = array
    (
        'database'         => array ( "localhost" , "root" , "XXXXXXXXXX" , "forgottenserver1" ),
        'vocations'        => array ( 0 => "Rookie" , 1 => "Sorcerer" , 2 => "Druid" , 3 => "Paladin" , 4 => "Knight" , 5 => "Master Sorcerer" , 6 => "Elder Druid" , 7 => "Royal Paladin" , 8 => "Elite Knight" ),
        'towns'            => array ( 0 => "Rookgaard" , 1 => "Central Park" , 2 => "BackAlley" ),
        'groups'           => array ( 2 => "Tutor" , 3 => "Senior Tutor" , 4 => "Gamemaster" , 5 => "Community Manager" , 6 => "God" ),
        'backgrounds'      => array ( 0 => 'background1' , 1 => 'background2' ),
        'color'            => '0,0,0' # Red, Green, Blue
    );
        
        
        

    class signature
    {
        
        // Database functions.
        function connectDatabase ( $database ) { @mysql_connect ( $database[0] , $database[1] , $database[2] ); @mysql_select_db ( $database[3] ); }
        function query ( $query ) { return @mysql_query ( $query ); }
        function fetchArray ( $query ) { return @mysql_fetch_array ( $query ); }
        function secure ( $query ) { return @mysql_real_escape_string ( $query ); }
        function numRows ( $query ) { return @mysql_num_rows ( $query ); }

        
        
        // Signature functions.
        function characterInfo ( $character , $groups , $vocations , $towns )
        {
            
            $character    = $this -> secure ( $character );
            $character    = "SELECT `id` , `group_id` , `name` , `sex` , `promotion` , `vocation` , `town_id` , `rank_id` , `online` , `level` , `lastlogin` FROM `players` WHERE `name` = '{$character}'";
            $numRows    = $this -> numRows ( $this -> query ( $character ) );
            $fetchRow    = $this -> fetchArray ( $this -> query ( $character ) );
            $guildranks = "SELECT `guild_id` , `name` FROM `guild_ranks` WHERE `id` = '{$fetchRow[rank_id]}'";
            $fetchRank    = $this -> fetchArray ( $this -> query ( $guildranks ) );
            $guilds        = "SELECT `name` FROM `guilds` WHERE `id` = '{$fetchRank[guild_id]}'";
            $fetchGuild    = $this -> fetchArray ( $this -> query ( $guilds ) );
            
            $name        = "Name: " . $fetchRow['name'] . " (" . ( $fetchRow['online'] == 1 ? 'online' : 'offline' ) . ")";
            $sex        = "\nSex: " . ( $fetchRow['sex'] == 1 ? 'Male' : 'Female' );
            $level        = "\nLevel: " . $fetchRow['level'];
            $profession = "\nProfession: " . ( $fetchRow['promotion'] != 0 ? $vocations[$fetchRow['vocation']+4] : $vocations[$fetchRow['vocation']] );
            $residence    = "\nResidence: " . $towns[$fetchRow['town_id']];
            $guild        = $fetchRow['rank_id'] > 0 ? "\nGuild: " . ( $fetchRow['sex'] == 1 ? 'He' : 'She' ) . " is " . $fetchRank['name'] . " of the " . $fetchGuild['name'] : NULL;
            $lastlogin    = "\nLast Login: " . date ( "M d Y, H:i:s" , $fetchRow['lastlogin'] );
            $position    = $fetchRow['group_id'] > 1 ? "\nPosition: " . $groups[$fetchRow['group_id']] : NULL;
            
            if ( $numRows == 1 )
                return $name . $sex . $level . $profession . $residence . $guild . $position . $lastlogin;
            else
                return "A character with that name does not exist.";
            
        }
        
        function printSignature ( $database , $backgrounds , $color , $vocations , $towns , $groups )
        {
            
            if ( empty ( $_GET ) ):
            
                ?>
                <form method="get">
                    Name: <input type="text" name="character" /><br /><br />
                    <?PHP
                        foreach ( $backgrounds as $bg => $value ):
                            echo '<input type="radio" name="image" value="' . $bg . '" /> <img src="' . $backgrounds[$bg] . '.png" /><br />';
                        endforeach;
                    ?>
                    <input type="submit" value="Create Signature" />
                </form>
                <?PHP
                
            else:
            
                $this -> connectDatabase ( $database );
                $content = $this -> characterInfo ( $_GET['character'] , $groups , $vocations , $towns );
                
                header ( "Content-type: image/png" );
                
                if ( file_exists ( "{$backgrounds[$_GET[image]]}.png" ) != 1 ):                    
                    $image = imagecreate ( 400 , 120 );
                    imagecolorallocate ( $image , 255 , 255 , 255 );
                    $content = "The requested image does not exist.";
                else:
                    $image = imagecreatefrompng ( $backgrounds[$_GET['image']] . ".png" );
                endif;
                    
                
                $color = explode ( ',' , $color );
                $texts = explode ( "\n" , $content );
                $i = 0;
                
                foreach ( $texts as $text ):
                    $i++;
                    imagestring (
                        $image,
                        2, 7, 12 * $i,
                        $text,
                        imagecolorallocate ( $image , $color[0] , $color[1] , $color[2] )
                    );
                endforeach;
                    
                imagepng ( $image );
                imagedestroy ( $image );
            
            endif;
            
        }
        
    }
    
    $image = new signature();
    $image -> printSignature ( $config['database'] , $config['backgrounds'] , $config['color'] , $config['vocations'] , $config['towns'] , $config['groups'] );
    
?>

Whots wrong with this?
 
Dont work for me :(
Warning: Cannot modify header information - headers already sent by (output started at C:\User\Server\ragal\xampp\htdocs\sign.php:1) in C:\User\Server\ragal\xampp\htdocs\sign.php on line 79
‰PNG  ��� IHDR�����x���æ6Ô���PLTEÿÿÿ���UÂÓ~���öIDATxœíÏ1jAÆñyÙg\DdV·H¹°Å[*ÌHˆì Ö[¤Él+±qQHÃˆP<<¤ä§!› º‘kK’{ZÌ»’G*%ù‰[$ÌòÞž´žù±ò(’%ŠM›k^³WžôÉYDù,Þ6ÔþçûÜ¿sVñǬüš6w¬Ç.%ÎôÏ ��������Àø},|fóiB����IEND®B`‚
 
Help-me!
Error

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\ot\cha.php:1) in C:\xampp\htdocs\ot\cha.php on line 79

Screen Shot:
2dsobvp.jpg

http://i39.tinypic.com/2dsobvp.jpg

sblguw.jpg

http://i41.tinypic.com/sblguw.jpg

Help!
 
im sure everyone does.....


Anyways start playing around with php.. i have found some cool things.. and i know how to make my own highscore list now... it's cool...

(found out by just trying to make the dang sig.... LOL)

Anyways if someone could figure out this error that would be nice..
i presented it to my tech teachers and they didnt know what would case it(then again they did codeing back in highschool..)
 
Due to one of my edits it gave the error, this has been resolved and if you take the NEW code from the first post you shouldn't encounter any errors.
 
Last edited:
Just wrap image tags around it and it should work (e.g. [img ]http://www.domain.tld/signature.php?character=myname&image=1[/img]).

I highly dislike Gesior AAC but as plenty of people are using it I guess I'll have to make it work with it.
 
'color' => '0,0,0'
0 can be changed up to 255. This is in basic RGB format, however I will make a function for you guys to be able to use hex instead (#000000 etc).
 
Back
Top