Raised This Month: $ Target: $400
 0% 

[TF2 Stats] With Web Ranking and Item Logger [v9.1.0]


Post New Thread Reply   
 
Thread Tools Display Modes
DarthNinja
SourceMod Plugin Approver
Join Date: Mar 2009
Location: PreThinkHook()
Old 06-30-2011 , 09:36   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1561

Your database.cfg file isn't configured properly.
__________________
DarthNinja is offline
McDean
Member
Join Date: May 2010
Old 06-30-2011 , 10:08   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1562

Quote:
Originally Posted by DarthNinja View Post
Your database.cfg file isn't configured properly.
ah so does that stop the plugin from working, ill have a look into it later, never changed it :S

Cheers
McDean is offline
McDean
Member
Join Date: May 2010
Old 06-30-2011 , 10:28   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1563

Quote:
Originally Posted by McDean View Post
ah so does that stop the plugin from working, ill have a look into it later, never changed it :S

Cheers
Yeah still no luck :/ started a fresh one and set up databases.cfg with no luck, same way I have always filled it out :/

Even without the database, the plugin should still load yet? Bcoz mine isnt :/

Last edited by McDean; 06-30-2011 at 11:15.
McDean is offline
Obsidian
Senior Member
Join Date: Jun 2011
Old 06-30-2011 , 10:37   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1564

Took a look at the backend code for the Web UI. I examined a few files, here's what I found regarding it.

inc/dbconnect.php - use a constant for the version. Storing version data in a global variable named $version can easily conflict with other applications when trying to integrate.

inc/settings.php - why is there a function in the settings file? you have an include file named "functions.php" -- having a function in settings is a bad idea and can confuse an end user. Keep the codebase organized.

index.php - In one area I see there's "mysql_query()" being called, and in another it's "mysql_query() or die()". Be consistent.
- There's a lot going on with the HTML generation. In some areas you flip in and out of parsing mode with the PHP start/end tags, and in some other areas you just stay in parsing mode and echo out data. Try to stick to one method.
- All HTML tag attributes should be quoted.
-
Code:
<table class="" style="border:none" width=500" border="0">
^ width attribute has a problem here - it's missing the start quote.

player.php - those six lines to assign "$bcmathloaded" can be easily shorted like so:
Code:
$bcmathloaded = (bool) extension_loaded('bcmath') ? true : false;
Less code, same effect.
- The function getMostEffectiveClasses() declared here seems to be completely useless. Considered removing it?
- Inconsistent style again for handling MySQL query errors.
- Wtf indentation.
- The preg_replace call here is not needed, use str_replace instead - it'll be faster, and the power of PCRE isn't needed here anyways
Code:
$milTime = preg_replace ($find, $replace, $newTime);
- Be consistent with how you assemble your strings. Either use your vars inline using double quotes, or concat with single quotes, or use sprintf(). Try not to mix the styles.
- regarding the use of curl here, I can't tell if it's necessary. Considered using file_get_contents() against the remote URL?
- Determining the "best class" code seems repetitive. Likely, a loop or a function could reduce the amount of code needed and make things more readable.
- ALL attributes should be quoted in HTML to validate.
- Determining the stats in the HTML for K/D could be reduced in size with a function.
- Linking to the tf2 wiki for the weapon's info uses target=_blanc; it should be target="_blank"



Overall:
- I also see there's differences in the templating. The index page only uses <html>, while the player.php page uses the XHTML spec. Again, be consistent.

HTML problems can also throw browsers into the unreliable "quirks mode" which usually screws up page display. If you stay very close to valid against the declared specification, you're most likely to avoid browser display issues.

The web UI would benefit greatly from the use of a template library. Either Smarty or Twig would be good to look into - it separates the HTML from the PHP, allowing you to separate the logic from the display code, and making it easier to change the look of the page without breaking the application itself.

Plus, take a look at PDO. It's got error handling in it that is easy to take advantage of -- you can set PDO to use exceptions, and just try/catch around queries in case they fail. Escaping is extremely easy to take advantage of as well.

Last edited by Obsidian; 06-30-2011 at 10:40.
Obsidian is offline
Dritz
Junior Member
Join Date: Jun 2011
Old 06-30-2011 , 15:24   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1565

Quote:
Originally Posted by galadril View Post
What is your php version on your server?
I've done some changes according to the errors on your server.. Please try this version:
http://www.multiupload.com/EB7O65ZNQ1

The only error that should still be there is about the curl_init function on the player page. Looks like this function is not allowed / present on your server: http://www.hotscripts.com/forums/php...curl_init.html
PHP version was in the post you quoted, it's 5.3.6-r1. This server is fairly new, and wasn't set up with PHP/MySQL support; did that just for TF2stats earlier this week .

Thanks for that build, but there are still errors scattered around every page. It doesn't look like the same ones anymore, though. Lack of curl support is also fixed on my end, so thanks for that tip; players is no longer totally blank but there's new errors there. If you need that URL again to take a look, it's http://tf2stats.subluminal.net
Dritz is offline
ufo56
New Member
Join Date: Jul 2010
Old 06-30-2011 , 17:06   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1566

hi

when i go to http://www.alienservers.ee/tf2/playe...M_0:1:18115181 then i get HTTP 500 (Internal Server Error). What causes this error ? In http error log

Code:
[root@alienservers tf]# tail /var/log/httpd/error_log
[Thu Jun 30 23:57:35 2011] [error] [client 62.65.52.132] PHP Notice:  Undefined index:  c in /var/www/html/tf2/player.php on line 18, referer: http://www.alienservers.ee/tf2/player_ranking.php
[Thu Jun 30 23:57:35 2011] [error] [client 62.65.52.132] PHP Notice:  Undefined index:  cn in /var/www/html/tf2/player.php on line 19, referer: http://www.alienservers.ee/tf2/player_ranking.php
[Thu Jun 30 23:57:35 2011] [error] [client 62.65.52.132] PHP Notice:  Undefined variable: title in /var/www/html/tf2/player.php on line 200, referer: http://www.alienservers.ee/tf2/player_ranking.php
[Thu Jun 30 23:57:35 2011] [error] [client 62.65.52.132] PHP Fatal error:  Invalid IP in /var/www/html/tf2/player.php on line 258, referer: http://www.alienservers.ee/tf2/player_ranking.php
[Thu Jun 30 23:57:35 2011] [error] [client 62.65.52.132] File does not exist: /var/www/html/favicon.ico
[Thu Jun 30 23:58:16 2011] [error] [client 62.65.52.132] PHP Notice:  Undefined index:  cc in /var/www/html/tf2/player.php on line 17
[Thu Jun 30 23:58:16 2011] [error] [client 62.65.52.132] PHP Notice:  Undefined index:  c in /var/www/html/tf2/player.php on line 18
[Thu Jun 30 23:58:16 2011] [error] [client 62.65.52.132] PHP Notice:  Undefined index:  cn in /var/www/html/tf2/player.php on line 19
[Thu Jun 30 23:58:16 2011] [error] [client 62.65.52.132] PHP Notice:  Undefined variable: title in /var/www/html/tf2/player.php on line 200
[Thu Jun 30 23:58:16 2011] [error] [client 62.65.52.132] PHP Fatal error:  Invalid IP in /var/www/html/tf2/player.php on line 258
ufo56 is offline
Obsidian
Senior Member
Join Date: Jun 2011
Old 06-30-2011 , 17:12   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1567

More nitpicking. In galadril's version, this stuff is also present still:

player_ranking.php -
Code:
$maxplayercount = mysql_num_rows( mysql_query( "SELECT name FROM `Player`" ) );
Use a select count query for optimum performance. You're not being nice to MySQL doing the query this way. Database get angryyyyy. >
-
Code:
$sqlweapon = "SELECT WEAPON FROM weapons WHERE NAME in ('Sniper Rifle', 'The Huntsman', 'The Ambassador')";
Pretty sure there's more headshot-capable weapons now.
- I smell XSS exploit potential. A "name" with HTML in it might be able to exploit the page. Hard to say, it depends on how that data is inserted in the plugin itself.

compare.php -
Code:
	$playercount++;
	$steamid = mysql_real_escape_string($statename);
  $sql = "SELECT * FROM `Player` WHERE `STEAMID` = '$steamid'";
	$ergebnis = mysql_query($sql);
Uhhhhh...looking at the context here, something doesn't seem right. $steamid, $statename...? Not to mention, if this is double-escaped like I suspect it might be, it means the door could be wide open for an injection.
-
Code:
									echo "<td class='".$tdclass."'><CENTER><FONT SIZE=1.5>" .$adritems['NAME']. "</FONT><br /><a class='wiki' href='http://wiki.teamfortress.com/wiki/" .$itemname. "' target=_blanc><img src='" .$adritems['IMGURL']. "' border=0 /></a></CENTER></td>";
All HTML tags should be lowercase. Also, <center> is deprecated in HTML5 and XHTML 1.0.
Obsidian is offline
galadril
Senior Member
Join Date: Apr 2009
Old 07-01-2011 , 13:46   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1568

Quote:
Originally Posted by Obsidian View Post
More nitpicking. In galadril's version, this stuff is also present still
Hi Obsidian,

Thanks for checking out the webui. You are more then welcome to do the changes on the ui.

Galadril
__________________
galadril is offline
galadril
Senior Member
Join Date: Apr 2009
Old 07-01-2011 , 13:48   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1569

Quote:
Originally Posted by Dritz View Post
Thanks for that build, but there are still errors scattered around every page. It doesn't look like the same ones anymore, though. Lack of curl support is also fixed on my end, so thanks for that tip; players is no longer totally blank but there's new errors there. If you need that URL again to take a look, it's http://tf2stats.subluminal.net
Aha, the errors are different now.. I'll check it out somewhere this weekend.!
__________________
galadril is offline
Obsidian
Senior Member
Join Date: Jun 2011
Old 07-01-2011 , 17:51   Re: [TF2 Stats] With Web Ranking and Item Logger [v8.0.1/v7.1.5]
Reply With Quote #1570

DarthNinja, I've got a couple of screenshots to show that it is indeed displaying messages in chat when rank_show is set to "0".

http://cloud.steampowered.com/ugc/59...857F1D000ADF6/
http://cloud.steampowered.com/ugc/59...D4BF4CF946B91/

@galadril Sure, if you put the web ui up in a github repository. Working without decent pull request/patch request management is more work for everyone in the end; if you don't wish to do so, I'll just continue working on my own custom version.
Obsidian is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 06:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode