Zonet
Web Developer
@up does this even work? lol
Obrazek "http://localhost/index.php?subtopic=sygnatura" nie może zostać wyświetlony, ponieważ zawiera błędy.
Image "http://localhost/index.php?subtopic=sygnatura" can not be showed, becouse its got errors.
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 ^_^
C:\xampp\htdocs\index.php :
case "sygnatura";
$subtopic = "Stwórz Sygnature";
$topic = "Stwórz Sygnature";
include("Sygnatura.php");
break;
C:\xampp\htdocs\sygnatura.php :
<?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'] );
?>
I Got this error tOOHelp-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:
![]()
http://i39.tinypic.com/2dsobvp.jpg
![]()
http://i41.tinypic.com/sblguw.jpg
Help!
'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).