4images Forum & Community
4images Issues / Ausgaben => Feedback & Suggestions => Topic started by: thunderstrike on November 03, 2007, 09:16:01 PM
-
This check for valid post comment chars after submit.
In details.php file,
find:
if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
$msg = $lang['comments_deactivated'];
}
else {
$user_name = un_htmlspecialchars(trim($HTTP_POST_VARS['user_name']));
$comment_headline = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_headline']));
$comment_text = un_htmlspecialchars(trim($HTTP_POST_VARS['comment_text']));
replace:
if ($row['image_allow_comments'] == 0 || !check_permission("auth_postcomment", $row['cat_id']) || !$row) {
$msg = $lang['comments_deactivated'];
} elseif (function_exists('check_post_comment_valid_chars') && !check_post_comment_valid_chars($HTTP_POST_VARS['comment_headline']) || !check_post_comment_valid_chars($HTTP_POST_VARS['comment_text'])) {
redirect("details.php?image_id=" . $id);
}
else {
$user_name = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['user_name']));
$comment_headline = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['comment_headline']));
$comment_text = un_htmlspecialchars(trim((string)$HTTP_POST_VARS['comment_text']));
In member.php file,
find:
if ($action == "uploadimage") {
if ($cat_id != 0 && (!isset($cat_cache[$cat_id]) || !check_permission("auth_upload", $cat_id))) {
show_error_page($lang['no_permission']);
exit;
}
add after:
if (function_exists('check_post_comment_valid_chars') && !check_post_comment_valid_chars($HTTP_POST_VARS['image_name']) || !check_post_comment_valid_chars($HTTP_POST_VARS['image_description'])) {
redirect("categories.php?cat_id=" . $cat_id);
}
In includes/functions.php file,
add before ?> :
if (!function_exists('check_post_comment_valid_chars')) {
function check_post_comment_valid_chars($text) {
return preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $text);
}
}
If fail, is redirect to details page (with same image ID and for member - with same category id).
-
last step
is add after ??? or before O_o
and thanks
-
Before ?>
-
thanks i know :P
but it must be changed :)
and thanks for ur post and ur nice replay :)
-
thunderstrike, You have here a mistake.
In includes/functions.php file,
add after ?> :
Before ?> is Correct
nobby
-
This is right. Post edit. ;)
-
seems it works now !!!?!?
dont know what happen lol
thunder the if statement is wrong ( i mean IF )
ïf(!function_exists('check_post_comment_valid_chars')) {
function check_post_comment_valid_chars($text) {
return preg_match("/[a-zA-Z0-9\.\,;:%&#@!\^-_~`\"'\[\]\{\}\*\/\?\(\)\n\r]/", $text);
}
}
ïf (!function_exists('check_post_comment_valid_chars')) {
-
@MrLovalove:?
I ... no get your post ... what is problem ? ...
-
not big deal !!
its cleared on my last post
:)
-
8O ... this is right ... so small :mrgreen:
Post fix. ;)