@-Shady
In order to do what I did in my signature you have to meet these server requirements:
PHP Enabled Server
MySQL or another DB
Access to your web server
There are several steps to this tutorial so please be patient as I get the all in here. You must follow these steps to the tee in order for this to work properly.
1. On your root folder of your server create the following folder structure:
sig/
sig/images/
sig/gd_fonts/
sig/includes/
2. Create the following .htaccess file and upload it to:
sig/
Code:
<FilesMatch "^.*\.png">
SetHandler application/x-httpd-php
</FilesMatch>
3. Create the following .htaccess file and upload it to:
sig/gd_fonts/
sig/images/
sig/includes/
Code:
<Limit GET POST HEAD PUT DELETE>
order deny,allow
deny from all
</Limit>
4. Create your background image and upload it to:
sig/images/
Code:
You can use the one I used for testing if you like:
http://www.eastcoastassassins.com/sig/sig_background.gif
You must upload the file above to:
sig/images/
I just put it here for your use
5. Creat a file in notepad or anyu other text editor with the following content:
Code:
<?php
$gdfonts = array(
'8x13iso', '9x15iso', 'andale12', 'atommicclock', 'bmreceipt',
'chowfun', 'courier8', 'dimurph', 'georgia8', 'proggyclean',
'proggysquare', 'systemex', 'terminal6', 'trisk'
);
//
//
//
if( !isset($image_info) || !isset($image_text) )
{
exit;
}
//
//
//
$sz = @getimagesize('./images/'.$image_info['image']);
if( !$sz )
{
exit;
}
$image_w = $sz[0];
$image_h = $sz[1];
//
//
//
@header('Content-type: image/png');
$im = @imagecreatefromgif('./images/'.$image_info['image']);
$rgb = ( isset($image_info['color']) ? $image_info['color'] : array(255, 255, 255) );
$bgColor = imagecolorallocate($im, $rgb[0], $rgb[1], $rgb[2]);
for( $i = 0; $i < count($image_text); $i++ )
{
if( !is_numeric($image_text[$i]['font']) )
{
$font = 1;
}
else if( $image_text[$i]['font'] < 0 )
{
$font = $image_text[$i]['font'] * -1;
}
else
{
if( !($font = @imageloadfont('./gd_fonts/'.$gdfonts[$image_text[$i]['font']].'.gdf')) )
{
$font = 1;
}
}
$rgb = $image_text[$i]['color'];
$fgColor = imagecolorallocate($im, $rgb[0], $rgb[1], $rgb[2]);
imagestring($im, $font, $image_text[$i]['x'], $image_text[$i]['y'], $image_text[$i]['text'], $fgColor);
}
imagepng($im);
imagedestroy($im);
?>
Save this file as dynamic_gd_image.php and upload it to:
sig/includes/
6. Create your main file in notepad or any other text editor with the following content:
Code:
<?php
$db_name = "";
$db_host = "";
$tb_name = "";
$db_user = "";
$db_pass = "";
$tb_name_two = "";
$connection = mysql_connect($db_host, $db_user, $db_pass) or die("Could not connect.");
$db = mysql_select_db($db_name, $connection);
$sql_two = "SELECT config_value FROM $tb_name_two WHERE config_name = 'total_socom_users'";
$result_two = mysql_query($sql_two, $connection);
while($row_two = mysql_fetch_array($result_two, MYSQL_ASSOC)){
$socom_total_users = $row_two['config_value'];
}
$query = "SELECT * FROM $tb_name WHERE socomsn = ''";
$result = mysql_query($query, $connection);
while ($row = mysql_fetch_array($result)) {
$socom_stats = $row['user_socom_stats'];
$socom_stat = explode(',', $socom_stats);
$SOCOM_GAMES = $socom_stat[3] . " games.";
$SOCOM_WON = $socom_stat[4] . " Wins, ";
$SOCOM_LOST = $socom_stat[5] . " Losses.";
$SOCOM_KILLS = $socom_stat[10] . " Kills, ";
$SOCOM_DEATHS = $socom_stat[11] . " Deaths.";
$SOCOM_MAP = "See me on " . $socom_stat[43];
$SOCOM_PREFERENCE = " " . $socom_stat[35];
$SOCOM_WEAPON = " with my " . $socom_stat[42] . ".";
$user_socom_rating = $socom_stat[1];
$socom_games_played = $socom_stat[3];
$socom_user_position = $socom_stat[1];
$socom_games_won = $socom_stat[4];
$socom_rank = "Enlisted";
if (($socom_games_played >= 100) || ($socom_games_won >= 50)) {
$socom_rank = "Officer";
}
if ($socom_rank == "Enlisted") {
if (($socom_games_played >= 0) && ($socom_games_played <= 4)) {
$socom_rank_title = "Seaman Recruit";
} else {
$socom_rank_title = "Not Ranked";
}
if (($socom_games_played >= 5) && ($socom_games_played <= 14)) {
$socom_rank_title = "Seaman Apprentice";
}
if (($socom_games_played >= 15) && ($socom_games_played <= 24)) {
$socom_rank_title = "Seaman";
}
if (($socom_games_played >= 25) && ($socom_games_played <= 39)) {
$socom_rank_title = "Petty Officer Third Class";
}
if (($socom_games_played >= 40) && ($socom_games_played <= 54)) {
$socom_rank_title = "Petty Officer Second Class";
}
if (($socom_games_played >= 55) && ($socom_games_played <= 74)) {
$socom_rank_title = "Petty Officer First Class";
}
if (($socom_games_played >= 75) && ($socom_games_played <= 100)) {
$socom_rank_title = "Chief Petty Officer";
}
}
if ($socom_rank == "Officer") {
$socom_percentile = $socom_user_position / $socom_total_users;
$socom_percentile = $socom_percentile * 100;
if (($socom_percentile > 0) && ($socom_percentile < 2)) {
$socom_rank_title = "Admiral";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/admiral.gif";
}
if (($socom_percentile >= 2) && ($socom_percentile < 5)) {
$socom_rank_title = "Vice Admiral";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/viceadmiral.gif";
}
if (($socom_percentile >= 5) && ($socom_percentile < 10)) {
$socom_rank_title = "Rear Admiral Upper Half";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/upperadmiral.gif";
}
if (($socom_percentile >= 10) && ($socom_percentile < 20)) {
$socom_rank_title = "Rear Admiral Lower Half";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/loweradmiral.gif";
}
if (($socom_percentile >= 20) && ($socom_percentile < 30)) {
$socom_rank_title = "Captain";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/captain.gif";
}
if (($socom_percentile >= 30) && ($socom_percentile < 40)) {
$socom_rank_title = "Commander";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/commander.gif";
}
if (($socom_percentile >= 40) && ($socom_percentile < 50)) {
$socom_rank_title = "Lieutenant Commander";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/ltcommander.gif";
}
if (($socom_percentile >= 50) && ($socom_percentile < 65)) {
$socom_rank_title = "Lieutenant";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/lieutenant.gif";
}
if (($socom_percentile >= 65) && ($socom_percentile < 80)) {
$socom_rank_title = "Lieutenant Junior Grade";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/ltjrgrade.gif";
}
if ($socom_percentile >= 80) {
$socom_rank_title = "Ensign";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/ensign.gif";
}
if ($socom_user_position <= 10) {
$socom_rank_title = "Fleet Admiral";
$socom_rank_image = "http://www.eastcoastassassisn.com/images/ranks/fivestaradmiral.gif";
}
}
}
$socom_rank_image = "<img src=\"$socom_rank_image\">";
$font = 3;
$x_pos = 7;
$y_inc = 7;
$line_number = 1;
imagestring($image, $font, $x_pos, $y_inc * $line_number, "INSANE.CASPER Stats", $clr_black);
$line_number = 3;
imagestring($image, $font, $x_pos, $y_inc * $line_number, $socom_rank_title . ": " . $SOCOM_GAMES, $clr_black);
$line_number = 5;
imagestring($image, $font, $x_pos, $y_inc * $line_number, $SOCOM_WON . $SOCOM_LOST, $clr_black);
$line_number = 7;
imagestring($image, $font, $x_pos, $y_inc * $line_number, $SOCOM_KILLS . $SOCOM_DEATHS, $clr_black);
imagepng($image);
imagedestroy($image);
?>
Save this page as whatever.png and upload it to:
sig/
8. Any other GD fonts that you would like to use will have to be uploaded to the following directory:
sig/gd_fonts/
All of these steps are based on having the XML stats read into a MySQL DB and then pulled out for use by the PHP script. I know it's a lot of steps, most of it I ripped from another excellent tutorial on the net, and adopted it for this purpose.
And people were wondering why I was going to charge to do this crap. Well, look over it and let me know what you don't get, and I'll see what else I can do to help.