Video Game Forums

Go Back   Video Game Forums > Miscellaneous > Older Threads

Older Threads This is where most of our older threads are located. These threads can still be replied to.


S3 Player Stats & Sigs
Reply
 
LinkBack Thread Tools Display Modes
Old 12-23-2005   #11
 


Join Date: Jul 2005
Location: Lusby, MD
Age: 30
Posts: 183

Send a message via AIM to Casper Send a message via MSN to Casper
@-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.
__________________

Casper is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Old 12-23-2005   #12
 


Join Date: Dec 2005
Location: canada
Posts: 4

Send a message via AIM to -Shady
Thank you a lot.

One question in step six
Code:
 <?php 
$db_name = ""; 
$db_host = ""; 
$tb_name = ""; 
$db_user = ""; 
$db_pass = "";
Do I fill that in with my info ? like my sql db name , pass etc ?
-Shady is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Old 12-23-2005   #13
 


Join Date: Jul 2005
Location: Lusby, MD
Age: 30
Posts: 183

Send a message via AIM to Casper Send a message via MSN to Casper
Exactly. Glad I could help.
__________________

Casper is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Old 12-23-2005   #14
 


Join Date: Dec 2005
Location: canada
Posts: 4

Send a message via AIM to -Shady
Ah, sorry to be a bother again. lol but how do I choose which stats I want to show. i.e. I want my weapon and map, instead of games played, ?
-Shady is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Old 12-23-2005   #15
 


Join Date: Jul 2005
Location: Lusby, MD
Age: 30
Posts: 183

Send a message via AIM to Casper Send a message via MSN to Casper
Change the lines below to pick which array of the SOCOM Stats you want to display.

Code:
imagestring($image, $font, $x_pos, $y_inc * $line_number, "INSANE.CASPER Stats", $clr_black);
imagestring($image, $font, $x_pos, $y_inc * $line_number, $socom_rank_title . ": " . $SOCOM_GAMES, $clr_black);
imagestring($image, $font, $x_pos, $y_inc * $line_number, $SOCOM_WON . $SOCOM_LOST, $clr_black);
imagestring($image, $font, $x_pos, $y_inc * $line_number, $SOCOM_KILLS . $SOCOM_DEATHS, $clr_black);
__________________

Casper is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Old 12-23-2005   #16
 


Join Date: Apr 2005
Location: Devil's Road
Posts: 1,043

.................................................. .....................I NEED AN ADULT!! I NEED AN ADULT!!!!!
__________________
Spookius is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Old 12-24-2005   #17
 


Join Date: Jul 2005
Location: Lusby, MD
Age: 30
Posts: 183

Send a message via AIM to Casper Send a message via MSN to Casper
Quote:
Originally Posted by Spookius
.................................................. .....................I NEED AN ADULT!! I NEED AN ADULT!!!!!
What are you talking about? Please don't spam this thread.

@-Shady
You have to have signed up at my site so that I can pull your stat information in order for any of this to work. I get the distinct feeling you haven't done so. None of the above steps will work unless your stat data exists on my server.
__________________

Casper is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Old 12-24-2005   #18
 
Hot Ice's Avatar
 


Join Date: Oct 2005
Location: Butler Pennsylvania
Posts: 33

Send a message via AIM to Hot Ice Send a message via MSN to Hot Ice Send a message via Yahoo to Hot Ice
yea
Hey Man how do you do that in your sig? Thats pretty Sweet
__________________

2x Crown Holder
Past Clans- [ eN]
Current Clan- [NaR]
Hot Ice is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Old 12-24-2005   #19
 
kill_fever's Avatar
 


Join Date: May 2005
Location: West Virginia
Age: 30
Posts: 365

Send a message via AIM to kill_fever
casper
@Casper

Thanks once again casper I used your script on my player profile page on my site so each individual person can click a link on their own profile page and see their stats.
__________________

www.armynavy.com Great deals on Dog Tags
www.bluegoldnews.com
kill_fever is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Old 12-24-2005   #20
 


Join Date: Jul 2005
Location: Lusby, MD
Age: 30
Posts: 183

Send a message via AIM to Casper Send a message via MSN to Casper
Re: yea
Quote:
Originally Posted by Hot Ice
Hey Man how do you do that in your sig? Thats pretty Sweet
The instructions for doing that start at the top of this page. You have to follow the instructions carefully.

@kill_fever
NP. Hope you enjoy. Let me know if you need something else.
__________________

Casper is offline  
Digg this Post!Add Post to del.icio.us
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

S3 Player Stats & Sigs


All times are GMT -4. The time now is 01:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO