4images Forum & Community

4images Issues / Ausgaben => Feedback & Suggestions => Topic started by: thunderstrike on September 08, 2007, 07:25:28 PM

Title: [FIX] - admin/stats.php
Post by: thunderstrike 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);
Title: Re: [FIX] - admin/stats.php
Post by: skiemor on October 08, 2007, 08:51:22 AM
Hello, what does this code replace do?

Best.
Title: Re: [FIX] - admin/stats.php
Post by: thunderstrike on October 08, 2007, 02:24:11 PM
Quote
Detail: Check variable for right result.

Is say right here. :?
Title: Re: [FIX] - admin/stats.php
Post by: skiemor 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
Title: Re: [FIX] - admin/stats.php
Post by: thunderstrike 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.
Title: Re: [FIX] - admin/stats.php
Post by: skiemor on October 08, 2007, 03:21:06 PM
Thank you, thunderstrike, I changed it. :-)