Author Topic: [FIX] - admin/stats.php  (Read 9062 times)

0 Members and 1 Guest are viewing this topic.

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
[FIX] - admin/stats.php
« on: September 08, 2007, 07:25:28 PM »
Detail: Check variable for right result.

Find:

Quote
$cat_id = intval($HTTP_POST_VARS['cat_id']);
$cat_hits = trim($HTTP_POST_VARS['cat_hits']);
$image_hits = trim($HTTP_POST_VARS['image_hits']);
$image_downloads = trim($HTTP_POST_VARS['image_downloads']);
$image_rating = trim($HTTP_POST_VARS['image_rating']);
$image_votes = trim($HTTP_POST_VARS['image_votes']);

replace:

Code: [Select]
$cat_id = (isset($HTTP_POST_VARS['cat_id'])) ? intval($HTTP_POST_VARS['cat_id']) : 0;
$cat_id = preg_replace("/[^0-9]+/i", "", $cat_id);
$cat_hits = (isset($HTTP_POST_VARS['cat_hits'])) ? intval($HTTP_POST_VARS['cat_hits']) : 0;
$cat_hits = preg_replace("/[^0-9]+/i", "", $cat_hits);
$image_hits = (isset($HTTP_POST_VARS['image_hits'])) ? intval($HTTP_POST_VARS['image_hits']) : 0;
$image_hits = preg_replace("/[^0-9]+/i", "", $image_hits);
$image_downloads = (isset($HTTP_POST_VARS['image_downloads'])) ? intval($HTTP_POST_VARS['image_downloads']) : 0;
$image_downloads = preg_replace("/[^0-9]+/i", "", $image_downloads);
$image_rating = (isset($HTTP_POST_VARS['image_rating'])) ? trim($HTTP_POST_VARS['image_rating']) : "0.00";
$image_rating = preg_replace("/[^\.0-9]+/i", "", $image_rating);
$image_votes = (isset($HTTP_POST_VARS['image_votes'])) ? intval($HTTP_POST_VARS['image_votes']) : 0;
$image_votes = preg_replace("/[^0-9]+/i", "", $image_votes);
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

skiemor

  • Guest
Re: [FIX] - admin/stats.php
« Reply #1 on: October 08, 2007, 08:51:22 AM »
Hello, what does this code replace do?

Best.
« Last Edit: October 08, 2007, 09:08:04 AM by skiemor »

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [FIX] - admin/stats.php
« Reply #2 on: October 08, 2007, 02:24:11 PM »
Quote
Detail: Check variable for right result.

Is say right here. :?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

skiemor

  • Guest
Re: [FIX] - admin/stats.php
« Reply #3 on: October 08, 2007, 02:47:30 PM »
I read it: "Detail: Check variable for right result." --> Prüfe Variable auf das richtige Ergebnis.
What does it mean? It's to short for me (newbie).
What's wrong in the old code, what is better in new code or is the code only for checking variable.

Sorry, I have to ask you again  :D

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [FIX] - admin/stats.php
« Reply #4 on: October 08, 2007, 03:16:05 PM »
Is make validation foreach POST variable. Original code no make check validation foreach variable. Is just place each variable for POST and is no right.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

skiemor

  • Guest
Re: [FIX] - admin/stats.php
« Reply #5 on: October 08, 2007, 03:21:06 PM »
Thank you, thunderstrike, I changed it. :-)