[Preview]Crossfire Stats Signature
Comments
-
whats the point of having this? if we cant post a sig in this forum
Being able to use signatures on the forums is coming soon enough, That aside. These sigs, like I said in the first post, are to be used on third party sites for the time being. Places like WOGL, Facebook, Fansites, etc. -
Thanks for the comments, and remember the source code for this is 100% available for anyone to edit and adjust. In other words, this is a open source project.
On a side note, I will still be working and adding further features onto the sigs. Any suggestions are welcomed, regardless if they're on new backgrounds or any extra calculation. -
Hand written code, all this code does is freakin' retrieve the info, took a while to get it right. It's really messy and it could've been done better with simpler functions, but w/e.
<?php //***** Looks like this is going to be one hell of a ***** to work out. ****/ error_reporting(0); // DISABLE ERROR HANDLE FOR THE TIME BEING $id = $_GET['id']; $style = $_GET['style']; if(!$id) { $id = "ID NOT ENTERED"; } $url = "http://clan.z8games.com/charstat_cf.aspx?usn=".$id; $raw = file_get_contents($url); $newlines = array("\t","\n","\r","\x20\x20","\0","\x0B"); $content = str_replace($newlines, "", html_entity_decode($raw)); // Matches Played $Pmplayed_start = strpos($content,'<span id="ctl00_Main_lbl_play_cnt">'); $Pmplayed_end = strpos($content,'</span>',$Pmplayed_start); $Pmplayed = substr($content,$Pmplayed_start,$Pmplayed_end-$Pmplayed_start); // Wins $Pwins_start = strpos($content,'<span id="ctl00_Main_lbl_win_cnt">');$Pwins_end = strpos($content,'</span>',$Pwins_start); $Pwins = substr($content,$Pwins_start,$Pwins_end-$Pwins_start); // Losses $losses_start = strpos($content,'<span id="ctl00_Main_lbl_lose_cnt">');$losses_end = strpos($content,'</span>',$losses_start); $Plosses = substr($content,$losses_start,$losses_end-$losses_start); // Kills $kills_start = strpos($content,'<span id="ctl00_Main_lbl_enemy_kill_cnt">');$kills_end = strpos($content,'</span>',$kills_start); $Pkills = substr($content,$kills_start,$kills_end-$kills_start); // Deaths $deaths_start = strpos($content,'<span id="ctl00_Main_lbl_death_cnt">');$deaths_end = strpos($content,'</span>',$deaths_start); $Pdeaths = substr($content,$deaths_start,$deaths_end-$deaths_start); // Exp. $exp_start = strpos($content,'<span id="ctl00_Main_lbl_exp">');$exp_end = strpos($content,'</span>',$exp_start); $Pexp = substr($content,$exp_start,$exp_end-$exp_start); // Headshots $headshots_start = strpos($content,'<span id="ctl00_Main_lbl_headshot_kill_cnt">');$headshots_end = strpos($content,'</span>',$headshots_start); $Pheadshots = substr($content,$headshots_start,$headshots_end-$headshots_start); // Team Kill $tk_start = strpos($content,'<span id="ctl00_Main_lbl_friend_kill_cnt">');$tk_end = strpos($content,'</span>',$tk_start); $Ptk = substr($content,$tk_start,$tk_end-$tk_start); // Desertion $desert_start = strpos($content,'<span id="ctl00_Main_lbl_escape_cnt">');$desert_end = strpos($content,'</span>',$desert_start); $Pdesert = substr($content,$desert_start,$desert_end-$desert_start); // Clan $clan_start = strpos($content,'<a id="ctl00_Main_lb_myclan"');$clan_end = strpos($content,'</a><span id="ctl00_Main_lbl_noclan">',$clan_start); $Pclan = substr($content,$clan_start,$clan_end-$clan_start); // Player Name $pname_start = strpos($content,'<span id="ctl00_Main_lbl_charactername">');$pname_end = strpos($content,'</span>',$pname_start); $Ppname = substr($content,$pname_start,$pname_end-$pname_start); // Kill/death Ratio preg_match_all ('|<[^>]+>(.*)|',$Pmplayed, $mplayed); preg_match_all ('|<[^>]+>(.*)|',$Pwins, $wins); preg_match_all ('|<[^>]+>(.*)|',$Plosses, $losses); preg_match_all ('|<[^>]+>(.*)|',$Pkills, $kills); preg_match_all ('|<[^>]+>(.*)|',$Pdeaths, $deaths); preg_match_all ('|<[^>]+>(.*)|',$Pexp, $exp); preg_match_all ('|<[^>]+>(.*)|',$Pheadshots, $headshots); preg_match_all ('|<[^>]+>(.*)|',$Ptk, $tk); preg_match_all ('|<[^>]+>(.*)|',$Pdesert, $desert); preg_match_all ('|<[^>]+>(.*)|',$Pclan, $clan); preg_match_all ('|<[^>]+>(.*)|',$Ppname, $pname); $kdratio = $kills[1][0] / $deaths[1][0]; echo "<b>Matches Played: </b>".$mplayed[1][0]."</br>"; echo "<b>Wins: </b>".$wins[1][0]."</br>"; echo "<b>Losses: </b>".$losses[1][0]."</br>"; echo "<b>Kills: </b>".$kills[1][0]."</br>"; echo "<b>Deaths: </b>".$deaths[1][0]."</br>"; echo "<b>Exp: </b>".$exp[1][0]."</br>"; echo "<b>Headshots: </b>".$headshots[1][0]."</br>"; echo "<b>Teamkills: </b>".$tk[1][0]."</br>"; echo "<b>Desertions: </b>".$desert[1][0]."</br>"; echo "<b>Clan: </b>".$clan[1][0]."</br>"; echo "<b>Name: </b>".$pname[1][0]."</br>"; echo "<b>KDR: </b>".round($kdratio, 2); ?>
With this code you can completely get everything about a person via the clan page. For anyone wondering, this code just page scraps.
Anywho, now we can move onto the simple stuff.
P.S anyone is free to use the code displayed above, however, credit me yo.
Idea - Cache something so you can reduce hits to Z8's server.
Could do one of the following...
1) Cache the received data from Z8 and keep using it until it is X hours old (a day or so)
2) This one can save CPU on your end too, and it's what I would do:
*When loading a new signature, run md5(serialize($_GET).date("Ymd")), generate the image with GD or whatever, and then save the image to disk as (thathash).jpg. Then, next time someone loads the sig, run a quick file_exists on the hash and see if you can just load it from disk and save CPU time on generating the image.
I'm tired, maybe this will help, just some suggestions
-
Idea - Cache something so you can reduce hits to Z8's server.
Could do one of the following...
1) Cache the received data from Z8 and keep using it until it is X hours old (a day or so)
2) This one can save CPU on your end too, and it's what I would do:
*When loading a new signature, run md5(serialize($_GET).date("Ymd")), generate the image with GD or whatever, and then save the image to disk as (thathash).jpg. Then, next time someone loads the sig, run a quick file_exists on the hash and see if you can just load it from disk and save CPU time on generating the image.
I'm tired, maybe this will help, just some suggestions
Those are some great ideas! I'll look into implementing them.
Categories
- All Categories
- Z8Games
- Off-Topic - Go To Game OT Forums
- 1 Z8 Forum Discussion & Suggestions
- 16 Z8Games Announcements
- Rules & Conduct
- 5.2K CrossFire
- 955 CrossFire Announcements
- 945 Previous Announcements
- 2 Previous Patch Notes
- 1.4K Community
- 122 Modes
- 602 Suggestions
- 85 Clan Discussion and Recruitment
- 274 CF Competitive Forum
- 19 CFCL
- 26 Looking for a Team?
- 705 CrossFire Support
- 52 Suggestion
- 116 Bugs
- 29 CrossFire Guides
- 166 Technical Issues
- 47 CrossFire Off Topic

i want to put it in my sig -__-