Can you do this with a dynamic image extension onto the php? for example:
http://silvermu.game-server.cc/dynamic/ ... b]?id=XTTX[/b]
Also, if someone would like to help me with my connection problems
Ok Well. I got my dynamic image code, and I haven't tested it, but it should work.
Code: Select all
<?php
//Get character's name from the URL
$CHARACTER = $_GET['id'];
//SQL Connection details
$conn = mssql_connect('localhost','sa','passwordremoved') or die('Could not make a connection to the Server');
$result = mssql_select_db('MuOnline', $conn) or die('Could not connect to the Database');
//SQL Query
$query = 'select Name,Class,cLevel,Strength,Agility,Vitality,Energy from Character where name = $CHARACTER';
$result = mssql_query( $query );
$row = mssql_fetch_row( $result );
//Class Info
if($row[1] == 0){
$CHR_CLASS = 'Dark Wizard';
}
if($row[1] == 1){
$CHR_CLASS = 'Soul Master';
}
//else{
if($row[1] == 16){
$CHR_CLASS = 'Dark Knight';
}
if($row[1] == 17){
$CHR_CLASS = 'Blade Knight';
}
if($row[1] == 32){
$CHR_CLASS = 'Elf';
}
if($row[1] == 33){
$CHR_CLASS = 'Muse Elf';
}
if($row[1] == 48){
$CHR_CLASS = 'Mage Gladiator';
}
if($row[1] == 64){
$CHR_CLASS = 'Darklord';
}
//Done
//Level Info
$LVL = $row[2];
//Done
//Stength Info
$STRENGTH = $row[3];
//Done
//Agility Info
$AGILITY = $row[4];
//Done
//Vitality Info
$VITALITY = $row[5];
//Done
//Energy Info
$ENERGY = $row[6];
//Done
//Guild Info
$GUILD = "TestGuild";
//Done
//Close Connection
$conn = mssql_close();
//Done
//Get Image File
$IMGVER_IMAGE = imagecreatefrompng("SilverMU Dynamic light.png");
//Done
//Set the color of the text
$TEXT_COLOR = ImageColorAllocate($IMGVER_IMAGE, 0, 0, 0); //Set the color of the Stats
//Done
//Set Text Features (color,size etc.)
//The 6 , 30 , 40 in the code below sets
//the size and the X,Y coords of the text
imageString($IMGVER_IMAGE , 4 , 30 , 43 , "Character: " . $CHARACTER . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 200 , 43 , "Class: " . $CHR_CLASS . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 335 , 43 , "Guild: " . $GUILD . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 30 , 65 , "Level: " . $LVL . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 125 , 65 , "Str: " . $STRENGTH . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 215 , 65 , "Agi: " . $AGILITY . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 305 , 65 , "Vit: " . $VITALITY . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 395 , 65 , "Nrg: " . $ENERGY . "" ,$TEXT_COLOR);
//Done
//Now We Send Image To The Browser
header("Content-type: image/png");
imagepng($IMGVER_IMAGE,'','100');
//Done
?>
And basically I want it to show the information that you see here (static image except for the charname)
http://silvermu.game-server.cc/dynamic/test.php?id=test
Which uses this code:
Code: Select all
<?php
//Server Name
$SERVER = "SilverMU";
//Character Info
$CHARACTER = $_GET['id']; //This gets the characters name from the URL
$CHR_CLASS = "Darklord"; //Could be an SQL Query for this
$GUILD = "TestGuild"; //Same as above
$LVL = "350";
$STRENGTH = "32000";
$AGILITY = "32000";
$VITALITY = "32000";
$ENERGY = "32000";
//Done
//Get Image File
$IMGVER_IMAGE = imagecreatefrompng("SilverMU Dynamic light.png");
//Done
//Set the color of the text
$SERVER_COLOR = ImageColorAllocate($IMGVER_IMAGE, 200, 0, 0); //Set the color of the Server Name
$TEXT_COLOR = ImageColorAllocate($IMGVER_IMAGE, 0, 0, 0); //Set the color of the Stats
//Done
//Set Text Features (color,size etc.)
//The 6 , 30 , 40 in the code below sets
//the size and the X,Y coords of the text
imageString($IMGVER_IMAGE , 6 , 30 , 20 , $SERVER ,$SERVER_COLOR);
imageString($IMGVER_IMAGE , 4 , 30 , 43 , "Character: " . $CHARACTER . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 200 , 43 , "Class: " . $CHR_CLASS . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 335 , 43 , "Guild: " . $GUILD . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 30 , 65 , "Level: " . $LVL . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 125 , 65 , "Str: " . $STRENGTH . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 215 , 65 , "Agi: " . $AGILITY . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 305 , 65 , "Vit: " . $VITALITY . "" ,$TEXT_COLOR);
imageString($IMGVER_IMAGE , 4 , 395 , 65 , "Nrg: " . $ENERGY . "" ,$TEXT_COLOR);
//Done
//Now We Send Image To The Browser
header("Content-type: image/gif");
imagepng($IMGVER_IMAGE,'','100');
//Done
?>
The problem in the SQL data grabbing version is that it won't connect to my SQL server. Yes I used the right username, IP, password, and the server is online. I enabled the mssql.dll file. IIS is enabled. Username sa has been given all permissions. I'm using a D-Link 120g router w/ Appserv. So anyways can someone help me? And tell me if you find any errors in my code.