4images Forum & Community
4images Issues / Ausgaben => Feedback & Suggestions => Topic started by: thunderstrike on September 08, 2007, 07:25:28 PM
-
Detail: Check variable for right result.
Find:
$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:
$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);
-
Hello, what does this code replace do?
Best.
-
Detail: Check variable for right result.
Is say right here. :?
-
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
-
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.
-
Thank you, thunderstrike, I changed it. :-)